]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/fixtfsi_test.c
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 //===--------------- fixtfsi_test.c - Test __fixtfsi ----------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 // This file tests __fixtfsi for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
17 #if __LDBL_MANT_DIG__ == 113
21 int __fixtfsi(long double a
);
23 int test__fixtfsi(long double a
, int expected
)
26 int ret
= (x
!= expected
);
29 printf("error in test__fixtfsi(%.20Lf) = %d, "
30 "expected %d\n", a
, x
, expected
);
35 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
41 #if __LDBL_MANT_DIG__ == 113
42 if (test__fixtfsi(makeInf128(), 0x7fffffff))
44 if (test__fixtfsi(0, 0x0))
46 if (test__fixtfsi(0x1.23456789abcdefp
+5, 0x24))
48 if (test__fixtfsi(0x1.23456789abcdefp
-3, 0x0))
50 if (test__fixtfsi(0x1.23456789abcdefp
+20, 0x123456))
52 if (test__fixtfsi(0x1.23456789abcdefp
+40, 0x7fffffff))
54 if (test__fixtfsi(0x1.23456789abcdefp
+256, 0x7fffffff))
56 if (test__fixtfsi(-0x1.23456789abcdefp
+20, 0xffedcbaa))
58 if (test__fixtfsi(-0x1.23456789abcdefp
+40, 0x80000000))