1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixtfsi
6 #if __LDBL_MANT_DIG__ == 113
10 int __fixtfsi(long double a
);
12 int test__fixtfsi(long double a
, int expected
)
15 int ret
= (x
!= expected
);
18 printf("error in test__fixtfsi(%.20Lf) = %d, "
19 "expected %d\n", a
, x
, expected
);
24 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
30 #if __LDBL_MANT_DIG__ == 113
31 if (test__fixtfsi(makeInf128(), 0x7fffffff))
33 if (test__fixtfsi(0, 0x0))
35 if (test__fixtfsi(0x1.23456789abcdefp
+5, 0x24))
37 if (test__fixtfsi(0x1.23456789abcdefp
-3, 0x0))
39 if (test__fixtfsi(0x1.23456789abcdefp
+20, 0x123456))
41 if (test__fixtfsi(0x1.23456789abcdefp
+40, 0x7fffffff))
43 if (test__fixtfsi(0x1.23456789abcdefp
+256, 0x7fffffff))
45 if (test__fixtfsi(-0x1.23456789abcdefp
+20, 0xffedcbaa))
47 if (test__fixtfsi(-0x1.23456789abcdefp
+40, 0x80000000))