1 //===-- addvti3_test.c - Test __addvti3 -----------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __addvti3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
21 // Effects: aborts if a + b overflows
23 ti_int
__addvti3(ti_int a
, ti_int b
);
25 int test__addvti3(ti_int a
, ti_int b
)
27 ti_int x
= __addvti3(a
, b
);
28 ti_int expected
= a
+ b
;
38 expectedt
.all
= expected
;
39 printf("error in test__addvti3(0x%llX%.16llX, 0x%llX%.16llX) = "
40 "0x%llX%.16llX, expected 0x%llX%.16llX\n",
41 at
.s
.high
, at
.s
.low
, bt
.s
.high
, bt
.s
.low
, xt
.s
.high
, xt
.s
.low
,
42 expectedt
.s
.high
, expectedt
.s
.low
);
53 // test__addvti3(make_ti(0x8000000000000000LL, 0x0000000000000000LL),
54 // make_ti(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL));
56 // test__addvti3(make_ti(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL),
57 // make_ti(0x8000000000000000LL, 0x0000000000000000LL));
59 // test__addvti3(make_ti(0x0000000000000000LL, 0x0000000000000001LL),
60 // make_ti(0x7FFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL));
62 // test__addvti3(make_ti(0x7FFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL),
63 // make_ti(0x0000000000000000LL, 0x0000000000000001LL));
65 if (test__addvti3(make_ti(0x8000000000000000LL
, 0x0000000000000000LL
),
66 make_ti(0x0000000000000000LL
, 0x0000000000000001LL
)))
68 if (test__addvti3(make_ti(0x0000000000000000LL
, 0x0000000000000001LL
),
69 make_ti(0x8000000000000000LL
, 0x0000000000000000LL
)))
71 if (test__addvti3(make_ti(0x8000000000000000LL
, 0x0000000000000000LL
),
72 make_ti(0x0000000000000000LL
, 0x0000000000000000LL
)))
74 if (test__addvti3(make_ti(0x0000000000000000LL
, 0x0000000000000000LL
),
75 make_ti(0x8000000000000000LL
, 0x0000000000000000LL
)))
77 if (test__addvti3(make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
),
78 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))
80 if (test__addvti3(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
),
81 make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))
83 if (test__addvti3(make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
),
84 make_ti(0x0000000000000000LL
, 0x0000000000000000LL
)))
86 if (test__addvti3(make_ti(0x0000000000000000LL
, 0x0000000000000000LL
),
87 make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))