1 //===-- addvdi3_test.c - Test __addvdi3 -----------------------------------===//
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 __addvdi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 // Effects: aborts if a + b overflows
21 di_int
__addvdi3(di_int a
, di_int b
);
23 int test__addvdi3(di_int a
, di_int b
)
25 di_int x
= __addvdi3(a
, b
);
26 di_int expected
= a
+ b
;
28 printf("error in test__addvdi3(0x%llX, 0x%llX) = %lld, expected %lld\n",
35 // test__addvdi3(0x8000000000000000LL, -1); // should abort
36 // test__addvdi3(-1, 0x8000000000000000LL); // should abort
37 // test__addvdi3(1, 0x7FFFFFFFFFFFFFFFLL); // should abort
38 // test__addvdi3(0x7FFFFFFFFFFFFFFFLL, 1); // should abort
40 if (test__addvdi3(0x8000000000000000LL
, 1))
42 if (test__addvdi3(1, 0x8000000000000000LL
))
44 if (test__addvdi3(0x8000000000000000LL
, 0))
46 if (test__addvdi3(0, 0x8000000000000000LL
))
48 if (test__addvdi3(0x7FFFFFFFFFFFFFFLL
, -1))
50 if (test__addvdi3(-1, 0x7FFFFFFFFFFFFFFLL
))
52 if (test__addvdi3(0x7FFFFFFFFFFFFFFFLL
, 0))
54 if (test__addvdi3(0, 0x7FFFFFFFFFFFFFFFLL
))