]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/builtins/Unit/extenddftf2_test.c
1 //===--------------- extenddftf2_test.c - Test __extenddftf2 --------------===//
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 __extenddftf2 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
17 #if __LDBL_MANT_DIG__ == 113
21 COMPILER_RT_ABI
long double __extenddftf2(double a
);
23 int test__extenddftf2(double a
, uint64_t expectedHi
, uint64_t expectedLo
)
25 long double x
= __extenddftf2(a
);
26 int ret
= compareResultLD(x
, expectedHi
, expectedLo
);
29 printf("error in test__extenddftf2(%f) = %.20Lf, "
30 "expected %.20Lf\n", a
, x
, fromRep128(expectedHi
, expectedLo
));
35 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
41 #if __LDBL_MANT_DIG__ == 113
43 if (test__extenddftf2(makeQNaN64(),
44 UINT64_C(0x7fff800000000000),
48 if (test__extenddftf2(makeNaN64(UINT64_C(0x7100000000000)),
49 UINT64_C(0x7fff710000000000),
53 if (test__extenddftf2(makeInf64(),
54 UINT64_C(0x7fff000000000000),
58 if (test__extenddftf2(0.0, UINT64_C(0x0), UINT64_C(0x0)))
61 if (test__extenddftf2(0x1.23456789abcdefp
+5,
62 UINT64_C(0x400423456789abcd),
63 UINT64_C(0xf000000000000000)))
65 if (test__extenddftf2(0x1.edcba987654321fp
-9,
66 UINT64_C(0x3ff6edcba9876543),
67 UINT64_C(0x2000000000000000)))
69 if (test__extenddftf2(0x1.23456789abcdefp
+45,
70 UINT64_C(0x402c23456789abcd),
71 UINT64_C(0xf000000000000000)))
73 if (test__extenddftf2(0x1.edcba987654321fp
-45,
74 UINT64_C(0x3fd2edcba9876543),
75 UINT64_C(0x2000000000000000)))