1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_udivmodsi4
9 extern COMPILER_RT_ABI su_int
__udivmodsi4(su_int a
, su_int b
, su_int
* rem
);
11 int test__udivmodsi4(su_int a
, su_int b
,
12 su_int expected_result
, su_int expected_rem
)
15 su_int result
= __udivmodsi4(a
, b
, &rem
);
16 if (result
!= expected_result
) {
17 printf("error in __udivmodsi4: %u / %u = %u, expected %u\n",
18 a
, b
, result
, expected_result
);
21 if (rem
!= expected_rem
) {
22 printf("error in __udivmodsi4: %u mod %u = %u, expected %u\n",
23 a
, b
, rem
, expected_rem
);
33 if (test__udivmodsi4(0, 1, 0, 0))
36 if (test__udivmodsi4(2, 1, 2, 0))
39 if (test__udivmodsi4(19, 5, 3, 4))
42 if (test__udivmodsi4(0x80000000, 8, 0x10000000, 0))
45 if (test__udivmodsi4(0x80000003, 8, 0x10000000, 3))