1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixtfdi
7 #if __LDBL_MANT_DIG__ == 113
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
);
20 printf("error in test__fixtfdi(%.20Lf) = %llX, "
21 "expected %llX\n", a
, x
, expected
);
26 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
32 #if __LDBL_MANT_DIG__ == 113
33 if (test__fixtfdi(makeInf128(), 0x7fffffffffffffffLL
))
35 if (test__fixtfdi(0, 0x0))
37 if (test__fixtfdi(0x1.23456789abcdefp
+5L, 0x24LL
))
39 if (test__fixtfdi(0x1.23456789abcdefp
-3L, 0x0LL
))
41 if (test__fixtfdi(0x1.23456789abcdef12345678p
+20L, 0x123456LL
))
43 if (test__fixtfdi(0x1.23456789abcdef12345678p
+40L, 0x123456789abLL
))
45 if (test__fixtfdi(0x1.23456789abcdef12345678p
+60L, 0x123456789abcdef1LL
))
47 if (test__fixtfdi(0x1.23456789abcdefp
+256L, 0x7fffffffffffffffLL
))
49 if (test__fixtfdi(-0x1.23456789abcdefp
+20L, 0xffffffffffedcbaaLL
))
51 if (test__fixtfdi(-0x1.23456789abcdefp
+40L, 0xfffffedcba987655LL
))
53 if (test__fixtfdi(-0x1.23456789abcdefp
+256L, 0x8000000000000000LL
))