]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/fixtfti_test.c
1 //===--------------- fixtfti_test.c - Test __fixtfti ----------------------===//
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 __fixtfti for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
17 #if __LDBL_MANT_DIG__ == 113
21 ti_int
__fixtfti(long double a
);
23 int test__fixtfti(long double a
, ti_int expected
)
25 ti_int x
= __fixtfti(a
);
26 int ret
= (x
!= expected
);
34 expectedt
.all
= expected
;
36 printf("error in test__fixtfti(%.20Lf) = 0x%.16llX%.16llX, "
37 "expected 0x%.16llX%.16llX\n",
38 a
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
, expectedt
.s
.low
);
43 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
49 #if __LDBL_MANT_DIG__ == 113
50 if (test__fixtfti(makeInf128(), make_ti(0x7fffffffffffffffLL
,
51 0xffffffffffffffffLL
)))
53 if (test__fixtfti(0, make_ti(0x0LL
, 0x0LL
)))
55 if (test__fixtfti(0x1.23456789abcdefp
+5L, make_ti(0x0LL
, 0x24LL
)))
57 if (test__fixtfti(0x1.23456789abcdefp
-3L, make_ti(0x0LL
, 0x0LL
)))
59 if (test__fixtfti(0x1.23456789abcdef12345678p
+20L,
60 make_ti(0x0LL
, 0x123456LL
)))
62 if (test__fixtfti(0x1.23456789abcdef123456789abcdep
+112L,
63 make_ti(0x123456789abcdLL
, 0xef123456789abcdeLL
)))
65 if (test__fixtfti(-0x1.23456789abcdef123456789abcdep
+112L,
66 make_ti(0xFFFEDCBA98765432LL
, 0x10EDCBA987654322LL
)))
68 if (test__fixtfti(0x1.23456789abcdefp
+256L, make_ti(0x7fffffffffffffffLL
,
69 0xffffffffffffffffLL
)))
71 if (test__fixtfti(-0x1.23456789abcdefp
+20L, make_ti(0xffffffffffffffffLL
,
72 0xffffffffffedcbaaLL
)))
74 if (test__fixtfti(-0x1.23456789abcdefp
+256L, make_ti(0x8000000000000000LL
,