1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_udivti3
12 COMPILER_RT_ABI tu_int
__udivti3(tu_int a
, tu_int b
);
14 int test__udivti3(tu_int a
, tu_int b
, tu_int expected_q
)
16 tu_int q
= __udivti3(a
, b
);
26 expected_qt
.all
= expected_q
;
27 printf("error in __udivti3: 0x%llX%.16llX / 0x%llX%.16llX = "
28 "0x%llX%.16llX, expected 0x%llX%.16llX\n",
29 at
.s
.high
, at
.s
.low
, bt
.s
.high
, bt
.s
.low
, qt
.s
.high
, qt
.s
.low
,
30 expected_qt
.s
.high
, expected_qt
.s
.low
);
32 return q
!= expected_q
;
40 if (test__udivti3(0, 1, 0))
42 if (test__udivti3(2, 1, 2))
44 if (test__udivti3(make_tu(0x8000000000000000uLL
, 0), 1,
45 make_tu(0x8000000000000000uLL
, 0)))
47 if (test__udivti3(make_tu(0x8000000000000000uLL
, 0), 2,
48 make_tu(0x4000000000000000uLL
, 0)))
50 if (test__udivti3(make_tu(0xFFFFFFFFFFFFFFFFuLL
, 0xFFFFFFFFFFFFFFFFuLL
), 2,
51 make_tu(0x7FFFFFFFFFFFFFFFuLL
, 0xFFFFFFFFFFFFFFFFuLL
)))