[AMDGPU] Remove s_wakeup_barrier instruction (#122277)
[llvm-project.git] / compiler-rt / test / builtins / Unit / fixtfdi_test.c
blob4dff7d9e729adb41642f323d4150c41a4c351f32
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixtfdi
4 #include "int_lib.h"
5 #include <stdio.h>
7 #if __LDBL_MANT_DIG__ == 113
9 #include "fp_test.h"
11 di_int __fixtfdi(long double a);
13 int test__fixtfdi(long double a, di_int expected)
15 di_int x = __fixtfdi(a);
16 int ret = (x != expected);
18 if (ret)
20 printf("error in test__fixtfdi(%.20Lf) = %llX, "
21 "expected %llX\n", a, x, expected);
23 return ret;
26 char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};
28 #endif
30 int main()
32 #if __LDBL_MANT_DIG__ == 113
33 if (test__fixtfdi(makeInf128(), 0x7fffffffffffffffLL))
34 return 1;
35 if (test__fixtfdi(0, 0x0))
36 return 1;
37 if (test__fixtfdi(0x1.23456789abcdefp+5L, 0x24LL))
38 return 1;
39 if (test__fixtfdi(0x1.23456789abcdefp-3L, 0x0LL))
40 return 1;
41 if (test__fixtfdi(0x1.23456789abcdef12345678p+20L, 0x123456LL))
42 return 1;
43 if (test__fixtfdi(0x1.23456789abcdef12345678p+40L, 0x123456789abLL))
44 return 1;
45 if (test__fixtfdi(0x1.23456789abcdef12345678p+60L, 0x123456789abcdef1LL))
46 return 1;
47 if (test__fixtfdi(0x1.23456789abcdefp+256L, 0x7fffffffffffffffLL))
48 return 1;
49 if (test__fixtfdi(-0x1.23456789abcdefp+20L, 0xffffffffffedcbaaLL))
50 return 1;
51 if (test__fixtfdi(-0x1.23456789abcdefp+40L, 0xfffffedcba987655LL))
52 return 1;
53 if (test__fixtfdi(-0x1.23456789abcdefp+256L, 0x8000000000000000LL))
54 return 1;
56 #else
57 printf("skipped\n");
59 #endif
60 return 0;