1 //===-- udivmodsi4_test.c - Test __udivmodsi4 -----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __udivmodsi4 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 extern su_int
__udivmodsi4(su_int a
, su_int b
, su_int
* rem
);
21 int test__udivmodsi4(su_int a
, su_int b
,
22 su_int expected_result
, su_int expected_rem
)
25 su_int result
= __udivmodsi4(a
, b
, &rem
);
26 if (result
!= expected_result
) {
27 printf("error in __udivmodsi4: %u / %u = %u, expected %u\n",
28 a
, b
, result
, expected_result
);
31 if (rem
!= expected_rem
) {
32 printf("error in __udivmodsi4: %u mod %u = %u, expected %u\n",
33 a
, b
, rem
, expected_rem
);
43 if (test__udivmodsi4(0, 1, 0, 0))
46 if (test__udivmodsi4(2, 1, 2, 0))
49 if (test__udivmodsi4(19, 5, 3, 4))
52 if (test__udivmodsi4(0x80000000, 8, 0x10000000, 0))
55 if (test__udivmodsi4(0x80000003, 8, 0x10000000, 3))