1 //===-- moddi3_test.c - Test __moddi3 -------------------------------------===//
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 __moddi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 di_int
__moddi3(di_int a
, di_int b
);
21 int test__moddi3(di_int a
, di_int b
, di_int expected
)
23 di_int x
= __moddi3(a
, b
);
25 printf("error in __moddi3: %lld %% %lld = %lld, expected %lld\n",
30 char assumption_1
[sizeof(di_int
) == 2*sizeof(si_int
)] = {0};
34 if (test__moddi3(0, 1, 0))
36 if (test__moddi3(0, -1, 0))
39 if (test__moddi3(5, 3, 2))
41 if (test__moddi3(5, -3, 2))
43 if (test__moddi3(-5, 3, -2))
45 if (test__moddi3(-5, -3, -2))
48 if (test__moddi3(0x8000000000000000LL
, 1, 0x0LL
))
50 if (test__moddi3(0x8000000000000000LL
, -1, 0x0LL
))
52 if (test__moddi3(0x8000000000000000LL
, 2, 0x0LL
))
54 if (test__moddi3(0x8000000000000000LL
, -2, 0x0LL
))
56 if (test__moddi3(0x8000000000000000LL
, 3, -2))
58 if (test__moddi3(0x8000000000000000LL
, -3, -2))