1 /* ===-- modsi3_test.c - Test __modsi3 -------------------------------------===
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 __modsi3 for the compiler_rt library.
12 * ===----------------------------------------------------------------------===
20 si_int
__modsi3(si_int a
, si_int b
);
22 int test__modsi3(si_int a
, si_int b
, si_int expected
) {
23 si_int x
= __modsi3(a
, b
);
25 fprintf(stderr
, "error in __modsi3: %d %% %d = %d, expected %d\n",
31 if (test__modsi3(0, 1, 0))
33 if (test__modsi3(0, -1, 0))
36 if (test__modsi3(5, 3, 2))
38 if (test__modsi3(5, -3, 2))
40 if (test__modsi3(-5, 3, -2))
42 if (test__modsi3(-5, -3, -2))
45 if (test__modsi3(0x80000000, 1, 0x0))
47 if (test__modsi3(0x80000000, 2, 0x0))
49 if (test__modsi3(0x80000000, -2, 0x0))
51 if (test__modsi3(0x80000000, 3, -2))
53 if (test__modsi3(0x80000000, -3, -2))