[AMDGPU] Remove s_wakeup_barrier instruction (#122277)
[llvm-project.git] / compiler-rt / test / builtins / Unit / subvsi3_test.c
blob57f2fd9b88ee8a9aae7c7d836659d8027d9743d2
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_subvsi3
4 #include "int_lib.h"
5 #include <stdio.h>
6 #include <stdlib.h>
8 // Returns: a - b
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;
18 if (x != expected)
19 printf("error in test__subvsi3(0x%X, 0x%X) = %d, expected %d\n",
20 a, b, x, expected);
21 return x != expected;
24 int main()
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))
33 return 1;
34 if (test__subvsi3(0x80000000, 0))
35 return 1;
36 if (test__subvsi3(-1, 0x80000000))
37 return 1;
38 if (test__subvsi3(0x7FFFFFFF, 1))
39 return 1;
40 if (test__subvsi3(0x7FFFFFFF, 0))
41 return 1;
42 if (test__subvsi3(1, 0x7FFFFFFF))
43 return 1;
44 if (test__subvsi3(0, 0x7FFFFFFF))
45 return 1;
46 if (test__subvsi3(-1, 0x7FFFFFFF))
47 return 1;
49 return 0;