tsan: do not sleep at exit if there are no other threads
[blocksruntime.git] / test / Unit / udivdi3_test.c
blob24843f8bde6a2fe46dc09d3e4da2bef7595e2161
1 //===-- udivdi3_test.c - Test __udivdi3 -----------------------------------===//
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 __udivdi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
14 #include "int_lib.h"
15 #include <stdio.h>
17 // Returns: a / b
19 du_int __udivdi3(du_int a, du_int b);
21 int test__udivdi3(du_int a, du_int b, du_int expected_q)
23 du_int q = __udivdi3(a, b);
24 if (q != expected_q)
25 printf("error in __udivdi3: %lld / %lld = %lld, expected %lld\n",
26 a, b, q, expected_q);
27 return q != expected_q;
30 int main()
32 if (test__udivdi3(0, 1, 0))
33 return 1;
34 if (test__udivdi3(2, 1, 2))
35 return 1;
36 if (test__udivdi3(0x8000000000000000uLL, 1, 0x8000000000000000uLL))
37 return 1;
38 if (test__udivdi3(0x8000000000000000uLL, 2, 0x4000000000000000uLL))
39 return 1;
40 if (test__udivdi3(0xFFFFFFFFFFFFFFFFuLL, 2, 0x7FFFFFFFFFFFFFFFuLL))
41 return 1;
43 return 0;