1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixtfti
7 #if __LDBL_MANT_DIG__ == 113
11 ti_int
__fixtfti(long double a
);
13 int test__fixtfti(long double a
, ti_int expected
)
15 ti_int x
= __fixtfti(a
);
16 int ret
= (x
!= expected
);
24 expectedt
.all
= expected
;
26 printf("error in test__fixtfti(%.20Lf) = 0x%.16llX%.16llX, "
27 "expected 0x%.16llX%.16llX\n",
28 a
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
, expectedt
.s
.low
);
33 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
39 #if __LDBL_MANT_DIG__ == 113
40 if (test__fixtfti(makeInf128(), make_ti(0x7fffffffffffffffLL
,
41 0xffffffffffffffffLL
)))
43 if (test__fixtfti(0, make_ti(0x0LL
, 0x0LL
)))
45 if (test__fixtfti(0x1.23456789abcdefp
+5L, make_ti(0x0LL
, 0x24LL
)))
47 if (test__fixtfti(0x1.23456789abcdefp
-3L, make_ti(0x0LL
, 0x0LL
)))
49 if (test__fixtfti(0x1.23456789abcdef12345678p
+20L,
50 make_ti(0x0LL
, 0x123456LL
)))
52 if (test__fixtfti(0x1.23456789abcdef123456789abcdep
+112L,
53 make_ti(0x123456789abcdLL
, 0xef123456789abcdeLL
)))
55 if (test__fixtfti(-0x1.23456789abcdef123456789abcdep
+112L,
56 make_ti(0xFFFEDCBA98765432LL
, 0x10EDCBA987654322LL
)))
58 if (test__fixtfti(0x1.23456789abcdefp
+256L, make_ti(0x7fffffffffffffffLL
,
59 0xffffffffffffffffLL
)))
61 if (test__fixtfti(-0x1.23456789abcdefp
+20L, make_ti(0xffffffffffffffffLL
,
62 0xffffffffffedcbaaLL
)))
64 if (test__fixtfti(-0x1.23456789abcdefp
+256L, make_ti(0x8000000000000000LL
,