1 //===-- negvti2_test.c - Test __negvti2 -----------------------------------===//
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 __negvti2 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
21 // Effects: aborts if -a overflows
23 ti_int
__negvti2(ti_int a
);
24 ti_int
__negti2(ti_int a
);
26 int test__negvti2(ti_int a
)
28 ti_int x
= __negvti2(a
);
29 ti_int expected
= __negti2(a
);
37 expectedt
.all
= expected
;
38 printf("error in __negvti2(0x%.16llX%.16llX) = 0x%.16llX%.16llX, "
39 "expected 0x%.16llX%.16llX\n",
40 at
.s
.high
, at
.s
.low
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
, expectedt
.s
.low
);
54 if (test__negvti2(-1))
58 if (test__negvti2(-2))
62 if (test__negvti2(-3))
64 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x00000000FFFFFFFELL
)))
66 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000002LL
)))
68 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x00000000FFFFFFFFLL
)))
70 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000001LL
)))
72 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000100000000LL
)))
74 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000000LL
)))
76 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000200000000LL
)))
78 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFE00000000LL
)))
80 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000300000000LL
)))
82 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFD00000000LL
)))
84 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x7FFFFFFFFFFFFFFFLL
)))
86 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0x8000000000000001LL
)))
88 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x7FFFFFFFFFFFFFFFLL
)))
90 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFE00000000LL
)))
92 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000200000000LL
)))
94 if (test__negvti2(make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFF00000000LL
)))
96 if (test__negvti2(make_ti(0x0000000000000000LL
, 0x0000000100000000LL
)))
98 // if (test__negvti2(make_ti(0x8000000000000000LL, 0x0000000000000000LL))) // abort
100 if (test__negvti2(make_ti(0x8000000000000000LL
, 0x0000000000000001LL
)))
102 if (test__negvti2(make_ti(0x7FFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))