[compiler-rt] [llvm] Add extendhfxf2 into compiler rt (PR #111099)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 23 23:38:15 PDT 2024
================
@@ -0,0 +1,67 @@
+// RUN: %clang_builtins %s %librt -o %t && %run %t
+// REQUIRES: librt_has_extendhfxf2
+
+#include <limits.h>
+#include <math.h> // for isnan, isinf
+#include <stdio.h>
+
+#if __LDBL_MANT_DIG__ >= 64 && defined(COMPILER_RT_HAS_FLOAT16)
+long double __extendhfxf2(_Float16 f);
+
+int test_extendhfxf2(_Float16 a, long double expected) {
+ long double x = __extendhfxf2(a);
+ __uint16_t *b = (void *)&a;
+ int ret = !(x == expected || (isnan(x) && isnan(expected)) ||
----------------
lntue wrote:
`!((isnan(x) && isnan(expected)) || x == expected)` should be enough.
https://github.com/llvm/llvm-project/pull/111099
More information about the llvm-commits
mailing list