1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_addvdi3
9 // Effects: aborts if a + b overflows
11 COMPILER_RT_ABI di_int
__addvdi3(di_int a
, di_int b
);
13 int test__addvdi3(di_int a
, di_int b
)
15 di_int x
= __addvdi3(a
, b
);
16 di_int expected
= a
+ b
;
18 printf("error in test__addvdi3(0x%llX, 0x%llX) = %lld, expected %lld\n",
25 // test__addvdi3(0x8000000000000000LL, -1); // should abort
26 // test__addvdi3(-1, 0x8000000000000000LL); // should abort
27 // test__addvdi3(1, 0x7FFFFFFFFFFFFFFFLL); // should abort
28 // test__addvdi3(0x7FFFFFFFFFFFFFFFLL, 1); // should abort
30 if (test__addvdi3(0x8000000000000000LL
, 1))
32 if (test__addvdi3(1, 0x8000000000000000LL
))
34 if (test__addvdi3(0x8000000000000000LL
, 0))
36 if (test__addvdi3(0, 0x8000000000000000LL
))
38 if (test__addvdi3(0x7FFFFFFFFFFFFFFLL
, -1))
40 if (test__addvdi3(-1, 0x7FFFFFFFFFFFFFFLL
))
42 if (test__addvdi3(0x7FFFFFFFFFFFFFFFLL
, 0))
44 if (test__addvdi3(0, 0x7FFFFFFFFFFFFFFFLL
))