1 //===-- divsi3_test.c - Test __divsi3 -------------------------------------===//
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 __divsi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 si_int
__divsi3(si_int a
, si_int b
);
21 int test__divsi3(si_int a
, si_int b
, si_int expected
)
23 si_int x
= __divsi3(a
, b
);
25 printf("error in __divsi3: %d / %d = %d, expected %d\n",
32 if (test__divsi3(0, 1, 0))
34 if (test__divsi3(0, -1, 0))
37 if (test__divsi3(2, 1, 2))
39 if (test__divsi3(2, -1, -2))
41 if (test__divsi3(-2, 1, -2))
43 if (test__divsi3(-2, -1, 2))
46 if (test__divsi3(0x80000000, 1, 0x80000000))
48 if (test__divsi3(0x80000000, -1, 0x80000000))
50 if (test__divsi3(0x80000000, -2, 0x40000000))
52 if (test__divsi3(0x80000000, 2, 0xC0000000))