1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_negvti2
12 // Effects: aborts if -a overflows
14 COMPILER_RT_ABI ti_int
__negvti2(ti_int a
);
15 COMPILER_RT_ABI ti_int
__negti2(ti_int a
);
17 int test__negvti2(ti_int a
)
19 ti_int x
= __negvti2(a
);
20 ti_int expected
= __negti2(a
);
28 expectedt
.all
= expected
;
29 printf("error in __negvti2(0x%.16llX%.16llX) = 0x%.16llX%.16llX, "
30 "expected 0x%.16llX%.16llX\n",
31 at
.s
.high
, at
.s
.low
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
, expectedt
.s
.low
);
45 if (test__negvti2(-1))
49 if (test__negvti2(-2))
53 if (test__negvti2(-3))
55 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x00000000FFFFFFFELL
)))
57 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000002LL
)))
59 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x00000000FFFFFFFFLL
)))
61 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000001LL
)))
63 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000100000000LL
)))
65 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000000LL
)))
67 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000200000000LL
)))
69 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFE00000000LL
)))
71 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000300000000LL
)))
73 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFD00000000LL
)))
75 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x7FFFFFFFFFFFFFFFLL
)))
77 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0x8000000000000001LL
)))
79 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x7FFFFFFFFFFFFFFFLL
)))
81 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFE00000000LL
)))
83 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000200000000LL
)))
85 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000000LL
)))
87 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000100000000LL
)))
89 // if (test__negvti2(make_ti(0x8000000000000000LL, 0x0000000000000000LL))) // abort
91 if (test__negvti2(make_ti(0x8000000000000000LL
, 0x0000000000000001LL
)))
93 if (test__negvti2(make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))