1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_subvsi3
10 // Effects: aborts if a - b overflows
12 COMPILER_RT_ABI si_int
__subvsi3(si_int a
, si_int b
);
14 int test__subvsi3(si_int a
, si_int b
)
16 si_int x
= __subvsi3(a
, b
);
17 si_int expected
= a
- b
;
19 printf("error in test__subvsi3(0x%X, 0x%X) = %d, expected %d\n",
26 // test__subvsi3(0x80000000, 1); // should abort
27 // test__subvsi3(0, 0x80000000); // should abort
28 // test__subvsi3(1, 0x80000000); // should abort
29 // test__subvsi3(0x7FFFFFFF, -1); // should abort
30 // test__subvsi3(-2, 0x7FFFFFFF); // should abort
32 if (test__subvsi3(0x80000000, -1))
34 if (test__subvsi3(0x80000000, 0))
36 if (test__subvsi3(-1, 0x80000000))
38 if (test__subvsi3(0x7FFFFFFF, 1))
40 if (test__subvsi3(0x7FFFFFFF, 0))
42 if (test__subvsi3(1, 0x7FFFFFFF))
44 if (test__subvsi3(0, 0x7FFFFFFF))
46 if (test__subvsi3(-1, 0x7FFFFFFF))