1 //===--------------- multf3_test.c - Test __multf3 ------------------------===//
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 __multf3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
16 #if __LDBL_MANT_DIG__ == 113
21 COMPILER_RT_ABI
long double __multf3(long double a
, long double b
);
23 int test__multf3(long double a
, long double b
,
24 uint64_t expectedHi
, uint64_t expectedLo
)
26 long double x
= __multf3(a
, b
);
27 int ret
= compareResultLD(x
, expectedHi
, expectedLo
);
30 printf("error in test__multf3(%.20Lf, %.20Lf) = %.20Lf, "
31 "expected %.20Lf\n", a
, b
, x
,
32 fromRep128(expectedHi
, expectedLo
));
37 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
43 #if __LDBL_MANT_DIG__ == 113
45 if (test__multf3(makeQNaN128(),
46 0x1.23456789abcdefp
+5L,
47 UINT64_C(0x7fff800000000000),
51 if (test__multf3(makeNaN128(UINT64_C(0x800030000000)),
52 0x1.23456789abcdefp
+5L,
53 UINT64_C(0x7fff800000000000),
57 if (test__multf3(makeInf128(),
58 0x1.23456789abcdefp
+5L,
59 UINT64_C(0x7fff000000000000),
63 if (test__multf3(0x1.2eab345678439abcdefea56782346p
+5L,
64 0x1.edcb34a235253948765432134674fp
-1L,
65 UINT64_C(0x400423e7f9e3c9fc),
66 UINT64_C(0xd906c2c2a85777c4)))
68 if (test__multf3(0x1.353e45674d89abacc3a2ebf3ff4ffp
-50L,
69 0x1.ed8764648369535adf4be3214567fp
-9L,
70 UINT64_C(0x3fc52a163c6223fc),
71 UINT64_C(0xc94c4bf0430768b4)))
73 if (test__multf3(0x1.234425696abcad34a35eeffefdcbap
+456L,
74 0x451.ed98d76e5d46e5f24323dff21ffp
+600L,
75 UINT64_C(0x44293a91de5e0e94),
76 UINT64_C(0xe8ed17cc2cdf64ac)))
78 if (test__multf3(0x1.4356473c82a9fabf2d22ace345defp
-234L,
79 0x1.eda98765476743ab21da23d45678fp
-455L,
80 UINT64_C(0x3d4f37c1a3137cae),
81 UINT64_C(0xfc6807048bc2836a)))
84 if (test__multf3(0x1.23456734245345p
-10000L,
85 0x1.edcba524498724p
-6497L,