1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_divdi3
9 COMPILER_RT_ABI di_int
__divdi3(di_int a
, di_int b
);
11 int test__divdi3(di_int a
, di_int b
, di_int expected
)
13 di_int x
= __divdi3(a
, b
);
15 printf("error in __divdi3: %lld / %lld = %lld, expected %lld\n",
20 char assumption_1
[sizeof(di_int
) == 2*sizeof(si_int
)] = {0};
24 if (test__divdi3(0, 1, 0))
26 if (test__divdi3(0, -1, 0))
29 if (test__divdi3(2, 1, 2))
31 if (test__divdi3(2, -1, -2))
33 if (test__divdi3(-2, 1, -2))
35 if (test__divdi3(-2, -1, 2))
38 if (test__divdi3(0x8000000000000000LL
, 1, 0x8000000000000000LL
))
40 if (test__divdi3(0x8000000000000000LL
, -1, 0x8000000000000000LL
))
42 if (test__divdi3(0x8000000000000000LL
, -2, 0x4000000000000000LL
))
44 if (test__divdi3(0x8000000000000000LL
, 2, 0xC000000000000000LL
))