1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_extendhfsf2
3 //===--------------- extendhfsf2_test.c - Test __extendhfsf2 --------------===//
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 // This file tests __extendhfsf2 for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
19 float __extendhfsf2(uint16_t a
);
21 int test__extendhfsf2(uint16_t a
, float expected
)
23 float x
= __extendhfsf2(a
);
24 int ret
= compareResultH(x
, expected
);
27 printf("error in test__extendhfsf2(%#.4x) = %f, "
28 "expected %f\n", a
, x
, expected
);
33 char assumption_1
[sizeof(__fp16
) * CHAR_BIT
== 16] = {0};
38 if (test__extendhfsf2(UINT16_C(0x7e00),
42 if (test__extendhfsf2(UINT16_C(0x7e00),
43 makeNaN32(UINT32_C(0x8000))))
46 if (test__extendhfsf2(UINT16_C(0x7c00),
49 if (test__extendhfsf2(UINT16_C(0xfc00),
53 if (test__extendhfsf2(UINT16_C(0x0),
56 if (test__extendhfsf2(UINT16_C(0x8000),
60 if (test__extendhfsf2(UINT16_C(0x4248),
63 if (test__extendhfsf2(UINT16_C(0xc248),
66 if (test__extendhfsf2(UINT16_C(0x7c00),
67 0x1.987124876876324p
+100f
))
69 if (test__extendhfsf2(UINT16_C(0x6e62),
72 if (test__extendhfsf2(UINT16_C(0x3c00),
75 if (test__extendhfsf2(UINT16_C(0x0400),
79 if (test__extendhfsf2(UINT16_C(0x0010),
82 if (test__extendhfsf2(UINT16_C(0x0001),
85 if (test__extendhfsf2(UINT16_C(0x8001),
88 if (test__extendhfsf2(UINT16_C(0x0001),
92 if (test__extendhfsf2(UINT16_C(0x0000),
95 if (test__extendhfsf2(UINT16_C(0x8000),
99 if (test__extendhfsf2(UINT16_C(0x7bff),
103 if (test__extendhfsf2(UINT16_C(0x7bff),
107 if (test__extendhfsf2(UINT16_C(0x7c00),
110 if (test__extendhfsf2(UINT16_C(0xfc00),