[compiler-rt] Add missing extendhfxf2 in compiler rt (PR #109090)
B I Mohammed Abbas via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 02:43:16 PDT 2024
https://github.com/biabbas updated https://github.com/llvm/llvm-project/pull/109090
>From 815093f3b7be89c268c722ba953877be7bfcafd6 Mon Sep 17 00:00:00 2001
From: B I Mohammed Abbas <bimohammadabbas at gmail.com>
Date: Thu, 26 Sep 2024 15:12:59 +0530
Subject: [PATCH] Add extendhfxf2 in compiler rt
---
compiler-rt/lib/builtins/CMakeLists.txt | 1 +
compiler-rt/lib/builtins/extendhfxf2.c | 18 ++++++++++++++++++
.../lib/builtins/macho_embedded/common.txt | 1 +
3 files changed, 20 insertions(+)
create mode 100644 compiler-rt/lib/builtins/extendhfxf2.c
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 9a0a50ee7003f1..97a9e508d37a32 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -104,6 +104,7 @@ set(GENERIC_SOURCES
divti3.c
extendsfdf2.c
extendhfsf2.c
+ extendhfxf2.c
ffsdi2.c
ffssi2.c
ffsti2.c
diff --git a/compiler-rt/lib/builtins/extendhfxf2.c b/compiler-rt/lib/builtins/extendhfxf2.c
new file mode 100644
index 00000000000000..ce70c0eaf87118
--- /dev/null
+++ b/compiler-rt/lib/builtins/extendhfxf2.c
@@ -0,0 +1,18 @@
+//===-- lib/extendhfxf2.c - half -> long double conversion -------------*- C -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#define SRC_HALF
+#define DST_DOUBLE
+#include "fp_extend_impl.inc"
+
+// Use a forwarding definition and noinline to implement a poor man's alias,
+// as there isn't a good cross-platform way of defining one.
+// Long double are expected to be as precise as double.
+COMPILER_RT_ABI NOINLINE long double __extendhfxf2(src_t a) {
+ return (long double)__extendXfYf2__(a);
+}
diff --git a/compiler-rt/lib/builtins/macho_embedded/common.txt b/compiler-rt/lib/builtins/macho_embedded/common.txt
index 819109768f5298..fa99bc239e68f2 100644
--- a/compiler-rt/lib/builtins/macho_embedded/common.txt
+++ b/compiler-rt/lib/builtins/macho_embedded/common.txt
@@ -60,6 +60,7 @@ divsf3
divsi3
extendsfdf2
extendhfsf2
+extendhfxf2
ffssi2
fixdfsi
fixsfsi
More information about the llvm-commits
mailing list