1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_extendhftf2
7 #if __LDBL_MANT_DIG__ == 113 && defined(COMPILER_RT_HAS_FLOAT16)
11 COMPILER_RT_ABI long double __extendhftf2(TYPE_FP16 a);
13 int test__extendhftf2(TYPE_FP16 a, uint64_t expectedHi, uint64_t expectedLo) {
14 long double x = __extendhftf2(a);
15 int ret = compareResultLD(x, expectedHi, expectedLo);
18 printf("error in test__extendhftf2(%#.4x) = %.20Lf, "
21 fromRep128(expectedHi, expectedLo));
26 char assumption_1[sizeof(TYPE_FP16) * CHAR_BIT == 16] = {0};
31 #if __LDBL_MANT_DIG__ == 113 && defined(COMPILER_RT_HAS_FLOAT16)
33 if (test__extendhftf2(makeQNaN16(),
34 UINT64_C(0x7fff800000000000),
38 if (test__extendhftf2(makeNaN16(UINT16_C(0x0100)),
39 UINT64_C(0x7fff400000000000),
43 if (test__extendhftf2(makeInf16(),
44 UINT64_C(0x7fff000000000000),
47 if (test__extendhftf2(-makeInf16(),
48 UINT64_C(0xffff000000000000),
52 if (test__extendhftf2(fromRep16(0x0U),
53 UINT64_C(0x0), UINT64_C(0x0)))
55 if (test__extendhftf2(fromRep16(0x8000U),
56 UINT64_C(0x8000000000000000),
60 if (test__extendhftf2(fromRep16(0x0010U),
61 UINT64_C(0x3feb000000000000),
62 UINT64_C(0x0000000000000000)))
64 if (test__extendhftf2(fromRep16(0x0001U),
65 UINT64_C(0x3fe7000000000000),
66 UINT64_C(0x0000000000000000)))
68 if (test__extendhftf2(fromRep16(0x8001U),
69 UINT64_C(0xbfe7000000000000),
70 UINT64_C(0x0000000000000000)))
74 if (test__extendhftf2(fromRep16(0x4248U),
75 UINT64_C(0x4000920000000000),
76 UINT64_C(0x0000000000000000)))
78 if (test__extendhftf2(fromRep16(0xc248U),
79 UINT64_C(0xc000920000000000),
80 UINT64_C(0x0000000000000000)))
83 if (test__extendhftf2(fromRep16(0x508cU),
84 UINT64_C(0x4004230000000000),
87 if (test__extendhftf2(fromRep16(0x1bb7U),
88 UINT64_C(0x3ff6edc000000000),