[libc-commits] [compiler-rt] [libc] [compiler-rt][builtins] libc-backed float16 extend/truncate builtins (PR #211882)

via libc-commits libc-commits at lists.llvm.org
Sat Aug 8 14:03:36 PDT 2026


================
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file implements compiler-rt's __extendhfsf2, extend float16 to float,
+/// on top of LLVM-libc's shared::extendhfsf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define SRC_HALF
+#define DST_SINGLE
+#include "fp_extend_impl.inc"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/extendhfsf2.h"
+
+#if defined(LIBC_TYPES_HAS_FLOAT16)
+extern "C" COMPILER_RT_ABI NOINLINE dst_t __extendhfsf2(src_t a) {
+  return LIBC_NAMESPACE::shared::extendhfsf2(__builtin_bit_cast(uint16_t, a));
+}
+#else
+extern "C" COMPILER_RT_ABI NOINLINE dst_t __extendhfsf2(src_t a) {
+  return __extendXfYf2__(a);
+}
+#endif
+
+extern "C" {
+#if defined(__ARM_EABI__)
+#if defined(COMPILER_RT_ARMHF_TARGET)
+AEABI_RTABI dst_t __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
+AEABI_RTABI dst_t __aeabi_h2f(src_t a) { return __extendhfsf2(a); }
----------------
hulxv wrote:

I think we should keep it. it's the same old one

https://github.com/llvm/llvm-project/pull/211882


More information about the libc-commits mailing list