1 //===-- modti3_test.c - Test __modti3 -------------------------------------===//
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 __modti3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
21 ti_int
__modti3(ti_int a
, ti_int b
);
23 int test__modti3(ti_int a
, ti_int b
, ti_int expected
)
25 ti_int x
= __modti3(a
, b
);
35 expectedt
.all
= expected
;
36 printf("error in __modti3: 0x%.16llX%.16llX %% 0x%.16llX%.16llX = "
37 "0x%.16llX%.16llX, expected 0x%.16llX%.16llX\n",
38 at
.s
.high
, at
.s
.low
, bt
.s
.high
, bt
.s
.low
, xt
.s
.high
, xt
.s
.low
,
39 expectedt
.s
.high
, expectedt
.s
.low
);
44 char assumption_1
[sizeof(ti_int
) == 2*sizeof(di_int
)] = {0};
51 if (test__modti3(0, 1, 0))
53 if (test__modti3(0, -1, 0))
56 if (test__modti3(5, 3, 2))
58 if (test__modti3(5, -3, 2))
60 if (test__modti3(-5, 3, -2))
62 if (test__modti3(-5, -3, -2))
65 if (test__modti3(0x8000000000000000LL
, 1, 0x0LL
))
67 if (test__modti3(0x8000000000000000LL
, -1, 0x0LL
))
69 if (test__modti3(0x8000000000000000LL
, 2, 0x0LL
))
71 if (test__modti3(0x8000000000000000LL
, -2, 0x0LL
))
73 if (test__modti3(0x8000000000000000LL
, 3, 2))
75 if (test__modti3(0x8000000000000000LL
, -3, 2))
78 if (test__modti3(make_ti(0x8000000000000000LL
, 0), 1, 0x0LL
))
80 if (test__modti3(make_ti(0x8000000000000000LL
, 0), -1, 0x0LL
))
82 if (test__modti3(make_ti(0x8000000000000000LL
, 0), 2, 0x0LL
))
84 if (test__modti3(make_ti(0x8000000000000000LL
, 0), -2, 0x0LL
))
86 if (test__modti3(make_ti(0x8000000000000000LL
, 0), 3, -2))
88 if (test__modti3(make_ti(0x8000000000000000LL
, 0), -3, -2))