tsan: do not sleep at exit if there are no other threads
[blocksruntime.git] / test / Unit / divdi3_test.c
blobc25f917a419ed34023ae5a65386356c3b330f473
1 //===-- divdi3_test.c - Test __divdi3 -------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests __divdi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
14 #include "int_lib.h"
15 #include <stdio.h>
17 // Returns: a / b
19 di_int __divdi3(di_int a, di_int b);
21 int test__divdi3(di_int a, di_int b, di_int expected)
23 di_int x = __divdi3(a, b);
24 if (x != expected)
25 printf("error in __divdi3: %lld / %lld = %lld, expected %lld\n",
26 a, b, x, expected);
27 return x != expected;
30 char assumption_1[sizeof(di_int) == 2*sizeof(si_int)] = {0};
32 int main()
34 if (test__divdi3(0, 1, 0))
35 return 1;
36 if (test__divdi3(0, -1, 0))
37 return 1;
39 if (test__divdi3(2, 1, 2))
40 return 1;
41 if (test__divdi3(2, -1, -2))
42 return 1;
43 if (test__divdi3(-2, 1, -2))
44 return 1;
45 if (test__divdi3(-2, -1, 2))
46 return 1;
48 if (test__divdi3(0x8000000000000000LL, 1, 0x8000000000000000LL))
49 return 1;
50 if (test__divdi3(0x8000000000000000LL, -1, 0x8000000000000000LL))
51 return 1;
52 if (test__divdi3(0x8000000000000000LL, -2, 0x4000000000000000LL))
53 return 1;
54 if (test__divdi3(0x8000000000000000LL, 2, 0xC000000000000000LL))
55 return 1;
57 return 0;