1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_extendhfsf2
8 float __extendhfsf2(TYPE_FP16 a
);
10 int test__extendhfsf2(TYPE_FP16 a
, uint32_t expected
)
12 float x
= __extendhfsf2(a
);
13 int ret
= compareResultF(x
, expected
);
16 printf("error in test__extendhfsf2(%#.4x) = %f, "
17 "expected %f\n", toRep16(a
), x
, fromRep32(expected
));
22 char assumption_1
[sizeof(TYPE_FP16
) * CHAR_BIT
== 16] = {0};
27 if (test__extendhfsf2(fromRep16(0x7e00),
28 UINT32_C(0x7fc00000)))
31 if (test__extendhfsf2(fromRep16(0x7f80),
32 UINT32_C(0x7ff00000)))
35 if (test__extendhfsf2(fromRep16(0x7c00),
36 UINT32_C(0x7f800000)))
39 if (test__extendhfsf2(fromRep16(0xfc00),
40 UINT32_C(0xff800000)))
43 if (test__extendhfsf2(fromRep16(0x0),
44 UINT32_C(0x00000000)))
47 if (test__extendhfsf2(fromRep16(0x8000),
48 UINT32_C(0x80000000)))
50 if (test__extendhfsf2(fromRep16(0x4248),
51 UINT32_C(0x40490000)))
53 if (test__extendhfsf2(fromRep16(0xc248),
54 UINT32_C(0xc0490000)))
56 if (test__extendhfsf2(fromRep16(0x6e62),
57 UINT32_C(0x45cc4000)))
59 if (test__extendhfsf2(fromRep16(0x3c00),
60 UINT32_C(0x3f800000)))
62 if (test__extendhfsf2(fromRep16(0x0400),
63 UINT32_C(0x38800000)))
66 if (test__extendhfsf2(fromRep16(0x0010),
67 UINT32_C(0x35800000)))
69 if (test__extendhfsf2(fromRep16(0x0001),
70 UINT32_C(0x33800000)))
72 if (test__extendhfsf2(fromRep16(0x8001),
73 UINT32_C(0xb3800000)))
75 if (test__extendhfsf2(fromRep16(0x0001),
76 UINT32_C(0x33800000)))
79 if (test__extendhfsf2(fromRep16(0x7bff),
80 UINT32_C(0x477fe000)))
83 if (test__extendhfsf2(fromRep16(0x7bff),
84 UINT32_C(0x477fe000)))