]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/fixtfsi_test.c
1 //===--------------- fixtfsi_test.c - Test __fixtfsi ----------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __fixtfsi for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
16 #if __LDBL_MANT_DIG__ == 113
20 int __fixtfsi(long double a
);
22 int test__fixtfsi(long double a
, int expected
)
25 int ret
= (x
!= expected
);
28 printf("error in test__fixtfsi(%.20Lf) = %d, "
29 "expected %d\n", a
, x
, expected
);
34 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
40 #if __LDBL_MANT_DIG__ == 113
41 if (test__fixtfsi(makeInf128(), 0x7fffffff))
43 if (test__fixtfsi(0, 0x0))
45 if (test__fixtfsi(0x1.23456789abcdefp
+5, 0x24))
47 if (test__fixtfsi(0x1.23456789abcdefp
-3, 0x0))
49 if (test__fixtfsi(0x1.23456789abcdefp
+20, 0x123456))
51 if (test__fixtfsi(0x1.23456789abcdefp
+40, 0x7fffffff))
53 if (test__fixtfsi(0x1.23456789abcdefp
+256, 0x7fffffff))
55 if (test__fixtfsi(-0x1.23456789abcdefp
+20, 0xffedcbaa))
57 if (test__fixtfsi(-0x1.23456789abcdefp
+40, 0x80000000))