[AMDGPU] Remove s_wakeup_barrier instruction (#122277)
[llvm-project.git] / compiler-rt / test / builtins / Unit / modsi3_test.c
blobf0ecdd002c8f20828609666f134bb9f23fe32376
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_modsi3
4 #include "int_lib.h"
5 #include <stdio.h>
7 /* Returns: a % b */
9 COMPILER_RT_ABI si_int __modsi3(si_int a, si_int b);
11 int test__modsi3(si_int a, si_int b, si_int expected) {
12 si_int x = __modsi3(a, b);
13 if (x != expected)
14 fprintf(stderr, "error in __modsi3: %d %% %d = %d, expected %d\n",
15 a, b, x, expected);
16 return x != expected;
19 int main() {
20 if (test__modsi3(0, 1, 0))
21 return 1;
22 if (test__modsi3(0, -1, 0))
23 return 1;
25 if (test__modsi3(5, 3, 2))
26 return 1;
27 if (test__modsi3(5, -3, 2))
28 return 1;
29 if (test__modsi3(-5, 3, -2))
30 return 1;
31 if (test__modsi3(-5, -3, -2))
32 return 1;
34 if (test__modsi3(0x80000000, 1, 0x0))
35 return 1;
36 if (test__modsi3(0x80000000, 2, 0x0))
37 return 1;
38 if (test__modsi3(0x80000000, -2, 0x0))
39 return 1;
40 if (test__modsi3(0x80000000, 3, -2))
41 return 1;
42 if (test__modsi3(0x80000000, -3, -2))
43 return 1;
45 return 0;