1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_addvsi3
9 // Effects: aborts if a + b overflows
11 COMPILER_RT_ABI si_int
__addvsi3(si_int a
, si_int b
);
13 int test__addvsi3(si_int a
, si_int b
)
15 si_int x
= __addvsi3(a
, b
);
16 si_int expected
= a
+ b
;
18 printf("error in test__addvsi3(0x%X, 0x%X) = %d, expected %d\n",
25 // test__addvsi3(0x80000000, -1); // should abort
26 // test__addvsi3(-1, 0x80000000); // should abort
27 // test__addvsi3(1, 0x7FFFFFFF); // should abort
28 // test__addvsi3(0x7FFFFFFF, 1); // should abort
30 if (test__addvsi3(0x80000000, 1))
32 if (test__addvsi3(1, 0x80000000))
34 if (test__addvsi3(0x80000000, 0))
36 if (test__addvsi3(0, 0x80000000))
38 if (test__addvsi3(0x7FFFFFFF, -1))
40 if (test__addvsi3(-1, 0x7FFFFFFF))
42 if (test__addvsi3(0x7FFFFFFF, 0))
44 if (test__addvsi3(0, 0x7FFFFFFF))