[llvm] RuntimeLibcalls: Fix wrongly typed x87/fp128 long double libcalls on x86 (PR #216979)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 03:20:03 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

The x86 and default libcall sets gated the l-suffixed long double libm
functions on OS conditions rather than the long double format. This
incorrectly provided the f80 libcalls on targets whose long double is not x87
(Windows-MSVC, UEFI, x86_64 Android), double-provided frexpl/ldexpl on musl,
and provided the fp128 sincosl on targets using double as long double (m68k).

Gate the l-suffixed libm math on the long double format, mirroring the earlier
AArch64 fix: x87 targets get the _f80 calls, fp128 targets the _f128 calls, and
double targets neither. The compiler-rt f80 helpers (__extendxftf2, __fixxfti,
__powixf2, ...) are keyed to the x86_fp80 IR type, not the long double format,
so they stay unconditional on x86.

Co-authored-by: Claude (Opus 4.8) <noreply@<!-- -->anthropic.com>

---

Patch is 42.03 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/216979.diff


8 Files Affected:

- (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+44-17) 
- (modified) llvm/test/CodeGen/Generic/fp128-exp10-libcall.ll (+5-2) 
- (modified) llvm/test/CodeGen/X86/finite-libcalls.ll (-359) 
- (modified) llvm/test/CodeGen/X86/fp128-libcalls-longdouble.ll (+9) 
- (added) llvm/test/CodeGen/X86/fp80-conv-libcalls.ll (+146) 
- (added) llvm/test/CodeGen/X86/fp80-math-libcalls.ll (+374) 
- (added) llvm/test/CodeGen/X86/fp80-math-no-libcall-error.ll (+92) 
- (modified) llvm/test/CodeGen/X86/ldexp-avx512.ll (+11-6) 


``````````diff
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 1176b9b5d1a5a..8cbb3231571ac 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -60,6 +60,7 @@ def IsEABI4 : LibcallPredicate<[{EABIVersion == EABI::EABI4}]>;
 def IsEABI5 : LibcallPredicate<[{EABIVersion == EABI::EABI5}]>;
 
 def IsLongDoubleF128 : LibcallPredicate<[{LongDoubleFormat == LongDoubleFormat::IEEEquad}]>;
+def IsLongDoubleX87 : LibcallPredicate<[{LongDoubleFormat == LongDoubleFormat::X87DoubleExtended}]>;
 
 def IsAMDGPU : LibcallPredicate<[{TT.isAMDGPU()}]>;
 def IsARM : LibcallPredicate<[{TT.isARM()}]>;
@@ -114,6 +115,21 @@ def isNotOSOpenBSD : RuntimeLibcallAvailability<(not IsOSOpenBSD)>;
 // True when the C `long double` type is IEEE fp128.
 def isLongDoubleF128 : RuntimeLibcallAvailability<(all_of IsLongDoubleF128)>;
 
+// True when the C `long double` type is the x87 80-bit extended format.
+def isLongDoubleX87 : RuntimeLibcallAvailability<(all_of IsLongDoubleX87)>;
+
+// x87 long double variants of sincosl/exp10l, which additionally depend on
+// the libc providing the sincos/exp10 extensions.
+def isLongDoubleX87AndHasSinCos : RuntimeLibcallAvailability<
+  (all_of IsLongDoubleX87, (any_of IsGNUEnv, IsOSFuchsia, IsAndroid))>;
+def isLongDoubleX87AndHasExp10 : RuntimeLibcallAvailability<
+  (all_of IsLongDoubleX87, (not IsOSDarwin))>;
+
+// fp128 long double sincosl, which additionally depends on the libc
+// providing the sincos extension.
+def isLongDoubleF128AndHasSinCos : RuntimeLibcallAvailability<
+  (all_of IsLongDoubleF128, (any_of IsGNUEnv, IsOSFuchsia, IsAndroid))>;
+
 def isOSWindows : RuntimeLibcallAvailability<(all_of IsOSWindows)>;
 def isNotOSWindows : RuntimeLibcallAvailability<(not IsOSWindows)>;
 def isNotOSLinux : RuntimeLibcallAvailability<(not IsOSLinux)>;
@@ -1986,6 +2002,17 @@ defvar DefaultRuntimeLibcallImpls_f80 =
     !filter(entry, AllDefaultRuntimeLibcallImpls,
             !match(!cast<string>(entry.Provides), "F80"));
 
+// The l-suffixed libm math functions, only correct when long double is x87.
+defvar DefaultRuntimeLibcallImpls_longdouble_f80 =
+    !filter(entry, AllDefaultRuntimeLibcallImpls,
+            !match(!cast<string>(entry), "l_f80"));
+
+// The compiler-rt helpers, keyed to the x86_fp80 IR type and available on all
+// x86 regardless of the long double format.
+defvar DefaultRuntimeLibcallImpls_f80_helpers =
+    !listremove(DefaultRuntimeLibcallImpls_f80,
+                DefaultRuntimeLibcallImpls_longdouble_f80);
+
 defvar DefaultRuntimeLibcallImpls_ppcf128 =
     !filter(entry, AllDefaultRuntimeLibcallImpls,
             !match(!cast<string>(entry.Provides), "PPCF128"));
@@ -2046,13 +2073,11 @@ defvar SecurityCheckCookieIfWinMSVC =
 
 defvar LibmHasSinCosF32 = LibcallImpls<(add sincosf), hasSinCos>;
 defvar LibmHasSinCosF64 =  LibcallImpls<(add sincos), hasSinCos>;
-defvar LibmHasSinCosF80 = LibcallImpls<(add sincosl_f80), hasSinCos>;
 defvar LibmHasSinCosF128 = LibcallImpls<(add sincosl_f128), hasSinCos>;
 defvar LibmHasSinCosPPCF128 = LibcallImpls<(add sincosl_ppcf128), hasSinCos>;
 
 defvar LibmHasExp10F32 = LibcallImpls<(add exp10f), hasExp10>;
 defvar LibmHasExp10F64 = LibcallImpls<(add exp10), hasExp10>;
-defvar LibmHasExp10F80 = LibcallImpls<(add exp10l_f80), hasExp10>;
 defvar LibmHasExp10F128 = LibcallImpls<(add exp10l_f128), hasExp10>;
 defvar LibmHasExp10PPCF128 = LibcallImpls<(add exp10l_ppcf128), hasExp10>;
 
@@ -2081,9 +2106,6 @@ defvar WinDefaultLibcallImpls = (add WinDefaultLibcallImplsBaseList,
 defvar LibmHasFrexpF32 = LibcallImpls<(add frexpf), isNotOSWindowsOrIsCygwinMinGW>;
 defvar LibmHasLdexpF32 = LibcallImpls<(add ldexpf), isNotOSWindowsOrIsCygwinMinGW>;
 
-defvar LibmHasFrexpF80 = LibcallImpls<(add frexpl_f80), isNotOSWindowsOrIsCygwinMinGW>;
-defvar LibmHasLdexpF80 = LibcallImpls<(add ldexpl_f80), isNotOSWindowsOrIsCygwinMinGW>;
-
 defvar LibmHasFrexpF128 = LibcallImpls<(add frexpl_f128), isNotOSWindowsOrIsCygwinMinGW>;
 defvar LibmHasLdexpF128 = LibcallImpls<(add ldexpl_f128), isNotOSWindowsOrIsCygwinMinGW>;
 
@@ -3410,9 +3432,11 @@ def isWin64NotCygMing : RuntimeLibcallAvailability<
 def darwinHas__bzero : RuntimeLibcallAvailability<
   (all_of IsMacOSX, MacOSXVersionAtLeast<10, 6>)>;
 
-// FIXME: This is has ldexpl/frexpl plus use f128 for long double.
-def hasExpFrexplLdexplF128 : RuntimeLibcallAvailability<
-  (all_of (any_of (not IsOSWindows), IsOSCygMing), (not IsGNUEnv))>;
+// frexpl_f80/ldexpl_f80/exp10l_f80 are added separately with their own
+// libc-availability guards, so drop them from the bulk x87 body.
+defvar X86LongDoubleF80Body =
+    !listremove(DefaultRuntimeLibcallImpls_longdouble_f80,
+                [frexpl_f80, ldexpl_f80, exp10l_f80]);
 
 // Use the f128 variants of math functions on x86
 defvar X86_F128_Libcalls = LibcallImpls<(add LibmF128Libcalls, LibmF128FiniteLibcalls), isGNUEnvironment>;
@@ -3430,18 +3454,19 @@ defvar X86CommonLibcalls =
   (add (sub WinDefaultLibcallImpls, WindowsDivRemMulLibcallOverrides, MemChkLibcalls),
        DarwinSinCosStret, DarwinExp10, DarwinMemsetPattern, MacOSUnlockedIO,
        X86_F128_Libcalls,
-       LibmHasSinCosF80, // FIXME: Depends on long double
+       LibcallImpls<(add sincosl_f80), isLongDoubleX87AndHasSinCos>,
        SinCosF32F64Libcalls,
        LibcallImpls<(add __bzero), darwinHas__bzero>,
        LibmHasFrexpF32, LibmHasLdexpF32,
-       LibmHasFrexpF80, LibmHasLdexpF80,
-       LibcallImpls<(add frexpl_f128, ldexpl_f128, exp10l_f128), hasExpFrexplLdexplF128>,
-       // The l-suffixed long double math is fp128 only when long double is fp128
-       // (e.g. x86_64 Android/OHOS). frexpl/ldexpl/exp10l are added above.
+       LibcallImpls<(add frexpl_f80, ldexpl_f80), isLongDoubleX87>,
+       LibcallImpls<(add X86LongDoubleF80Body), isLongDoubleX87>,
+       // The x86_fp80 compiler-rt helpers are format-independent.
+       DefaultRuntimeLibcallImpls_f80_helpers,
+       LibcallImpls<(add frexpl_f128, ldexpl_f128, exp10l_f128), isLongDoubleF128>,
        LibcallImpls<(add X86LongDoubleF128Body), isLongDoubleF128>,
-       DefaultRuntimeLibcallImpls_f80,
-       LibmHasExp10F32, LibmHasExp10F64, LibmHasExp10F80,
-       LibcallImpls<(add MostPowI), isNotOSMSVCRT>,
+       LibmHasExp10F32, LibmHasExp10F64,
+       LibcallImpls<(add exp10l_f80), isLongDoubleX87AndHasExp10>,
+       LibcallImpls<(add __powisf2, __powidf2), isNotOSMSVCRT>,
        SecurityCheckCookieIfWinMSVC,
        // FIXME: MSVCRT doesn't have powi. The f128 case is added as a
        // hack for one test relying on it.
@@ -3630,7 +3655,9 @@ def isArch64Bit : RuntimeLibcallAvailability<(all_of IsArch64Bit)>;
 def LegacyDefaultSystemLibrary
     : SystemRuntimeLibrary<isDefaultLibcallArch,
       (add DefaultRuntimeLibcallImpls,
-         LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
+         LibmHasSinCosF32, LibmHasSinCosF64,
+         // sincosl is fp128 only when long double is fp128.
+         LibcallImpls<(add sincosl_f128), isLongDoubleF128AndHasSinCos>,
          exp10f, exp10, exp10l_f128,
          __powisf2, __powidf2, __powitf2_f128,
          LibcallImpls<(add Int128RTLibcalls), isArch64Bit>,
diff --git a/llvm/test/CodeGen/Generic/fp128-exp10-libcall.ll b/llvm/test/CodeGen/Generic/fp128-exp10-libcall.ll
index 54ac792da1374..934dc230370b8 100644
--- a/llvm/test/CodeGen/Generic/fp128-exp10-libcall.ll
+++ b/llvm/test/CodeGen/Generic/fp128-exp10-libcall.ll
@@ -10,14 +10,17 @@
 ; RUN: %if riscv-registered-target   %{ llc < %s -mtriple=riscv32-unknown-linux-gnu    | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-USELD %}
 ; RUN: %if systemz-registered-target %{ llc < %s -mtriple=s390x-unknown-linux-gnu      | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-S390X %}
 ; RUN: %if x86-registered-target     %{ llc < %s -mtriple=i686-unknown-linux-gnu       | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-F128  %}
-; RUN: %if x86-registered-target     %{ llc < %s -mtriple=i686-unknown-linux-musl      | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-USELD %}
+; RUN: %if x86-registered-target     %{ not llc -mtriple=i686-unknown-linux-musl   -filetype=null %s 2>&1 | FileCheck --check-prefix=ERR %s %}
 ; RUN: %if x86-registered-target     %{ llc < %s -mtriple=x86_64-unknown-linux-gnu     | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-F128  %}
-; RUN: %if x86-registered-target     %{ llc < %s -mtriple=x86_64-unknown-linux-musl    | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-USELD %}
+; RUN: %if x86-registered-target     %{ not llc -mtriple=x86_64-unknown-linux-musl -filetype=null %s 2>&1 | FileCheck --check-prefix=ERR %s %}
 
 ; FIXME(#144006): Windows-MSVC should also be run but has a ldexp selection failure.
 ; %if x86-registered-target     %{ llc < %s -mtriple=x86_64-pc-windows-msvc       | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-F128  %}
 ; %if aarch64-registered-target %{ llc < %s -mtriple=arm64ec-pc-windows-msvc      | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-F128  %}
 
+; x86 musl has x87 long double, so it provides neither exp10l_f128 (fp128 long
+; double) nor exp10f128 (a glibc _Float128 function), and must diagnose instead.
+
 ; ERR: error: no libcall available for fexp10
 define fp128 @test_exp10(fp128 %a) {
 ; CHECK-ALL-LABEL:  test_exp10:
diff --git a/llvm/test/CodeGen/X86/finite-libcalls.ll b/llvm/test/CodeGen/X86/finite-libcalls.ll
index acc7ddeb9a886..a28d87cf5ba96 100644
--- a/llvm/test/CodeGen/X86/finite-libcalls.ll
+++ b/llvm/test/CodeGen/X86/finite-libcalls.ll
@@ -75,63 +75,6 @@ define double @exp_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @exp_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: exp_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $24, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq expl at PLT
-; GNU-NEXT:    addq $24, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: exp_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $64, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    callq expl
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $64, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: exp_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $24, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _expl
-; MAC-NEXT:    addq $24, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: exp_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $12, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    calll expl
-; GISEL-X86-NEXT:    addl $12, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: exp_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $24, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fstpt (%rsp)
-; GISEL-X64-NEXT:    callq expl
-; GISEL-X64-NEXT:    addq $24, %rsp
-; GISEL-X64-NEXT:    retq
-  %r = tail call nnan ninf x86_fp80 @llvm.exp.f80(x86_fp80 %x)
-  ret x86_fp80 %r
-}
-
 define float @exp2_f32(float %x) #0 {
 ; GNU-LABEL: exp2_f32:
 ; GNU:       # %bb.0:
@@ -199,63 +142,6 @@ define double @exp2_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @exp2_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: exp2_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $24, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq exp2l at PLT
-; GNU-NEXT:    addq $24, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: exp2_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $64, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    callq exp2l
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $64, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: exp2_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $24, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _exp2l
-; MAC-NEXT:    addq $24, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: exp2_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $12, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    calll exp2l
-; GISEL-X86-NEXT:    addl $12, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: exp2_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $24, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fstpt (%rsp)
-; GISEL-X64-NEXT:    callq exp2l
-; GISEL-X64-NEXT:    addq $24, %rsp
-; GISEL-X64-NEXT:    retq
-  %r = tail call nnan ninf x86_fp80 @llvm.exp2.f80(x86_fp80 %x)
-  ret x86_fp80 %r
-}
-
 define float @log_f32(float %x) #0 {
 ; GNU-LABEL: log_f32:
 ; GNU:       # %bb.0:
@@ -323,63 +209,6 @@ define double @log_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @log_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: log_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $24, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq logl at PLT
-; GNU-NEXT:    addq $24, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: log_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $64, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    callq logl
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $64, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: log_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $24, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _logl
-; MAC-NEXT:    addq $24, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: log_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $12, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    calll logl
-; GISEL-X86-NEXT:    addl $12, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: log_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $24, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fstpt (%rsp)
-; GISEL-X64-NEXT:    callq logl
-; GISEL-X64-NEXT:    addq $24, %rsp
-; GISEL-X64-NEXT:    retq
-  %r = tail call nnan ninf x86_fp80 @llvm.log.f80(x86_fp80 %x)
-  ret x86_fp80 %r
-}
-
 define float @log2_f32(float %x) #0 {
 ; GNU-LABEL: log2_f32:
 ; GNU:       # %bb.0:
@@ -447,63 +276,6 @@ define double @log2_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @log2_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: log2_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $24, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq log2l at PLT
-; GNU-NEXT:    addq $24, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: log2_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $64, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    callq log2l
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $64, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: log2_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $24, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _log2l
-; MAC-NEXT:    addq $24, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: log2_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $12, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    calll log2l
-; GISEL-X86-NEXT:    addl $12, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: log2_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $24, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fstpt (%rsp)
-; GISEL-X64-NEXT:    callq log2l
-; GISEL-X64-NEXT:    addq $24, %rsp
-; GISEL-X64-NEXT:    retq
-  %r = tail call nnan ninf x86_fp80 @llvm.log2.f80(x86_fp80 %x)
-  ret x86_fp80 %r
-}
-
 define float @log10_f32(float %x) #0 {
 ; GNU-LABEL: log10_f32:
 ; GNU:       # %bb.0:
@@ -571,63 +343,6 @@ define double @log10_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @log10_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: log10_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $24, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq log10l at PLT
-; GNU-NEXT:    addq $24, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: log10_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $64, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    callq log10l
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $64, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: log10_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $24, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _log10l
-; MAC-NEXT:    addq $24, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: log10_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $12, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    calll log10l
-; GISEL-X86-NEXT:    addl $12, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: log10_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $24, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fstpt (%rsp)
-; GISEL-X64-NEXT:    callq log10l
-; GISEL-X64-NEXT:    addq $24, %rsp
-; GISEL-X64-NEXT:    retq
-  %r = tail call nnan ninf x86_fp80 @llvm.log10.f80(x86_fp80 %x)
-  ret x86_fp80 %r
-}
-
 define float @pow_f32(float %x) #0 {
 ; GNU-LABEL: pow_f32:
 ; GNU:       # %bb.0:
@@ -708,97 +423,23 @@ define double @pow_f64(double %x) #0 {
   ret double %r
 }
 
-define x86_fp80 @pow_f80(x86_fp80 %x) #0 {
-; GNU-LABEL: pow_f80:
-; GNU:       # %bb.0:
-; GNU-NEXT:    subq $40, %rsp
-; GNU-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fld %st(0)
-; GNU-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; GNU-NEXT:    fstpt (%rsp)
-; GNU-NEXT:    callq powl at PLT
-; GNU-NEXT:    addq $40, %rsp
-; GNU-NEXT:    retq
-;
-; WIN-LABEL: pow_f80:
-; WIN:       # %bb.0:
-; WIN-NEXT:    pushq %rsi
-; WIN-NEXT:    subq $80, %rsp
-; WIN-NEXT:    movq %rcx, %rsi
-; WIN-NEXT:    fldt (%rdx)
-; WIN-NEXT:    fld %st(0)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rcx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %rdx
-; WIN-NEXT:    leaq {{[0-9]+}}(%rsp), %r8
-; WIN-NEXT:    callq powl
-; WIN-NEXT:    fldt {{[0-9]+}}(%rsp)
-; WIN-NEXT:    fstpt (%rsi)
-; WIN-NEXT:    movq %rsi, %rax
-; WIN-NEXT:    addq $80, %rsp
-; WIN-NEXT:    popq %rsi
-; WIN-NEXT:    retq
-;
-; MAC-LABEL: pow_f80:
-; MAC:       ## %bb.0:
-; MAC-NEXT:    subq $40, %rsp
-; MAC-NEXT:    fldt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fld %st(0)
-; MAC-NEXT:    fstpt {{[0-9]+}}(%rsp)
-; MAC-NEXT:    fstpt (%rsp)
-; MAC-NEXT:    callq _powl
-; MAC-NEXT:    addq $40, %rsp
-; MAC-NEXT:    retq
-;
-; GISEL-X86-LABEL: pow_f80:
-; GISEL-X86:       # %bb.0:
-; GISEL-X86-NEXT:    subl $28, %esp
-; GISEL-X86-NEXT:    fldt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    fld %st(0)
-; GISEL-X86-NEXT:    fstpt (%esp)
-; GISEL-X86-NEXT:    fstpt {{[0-9]+}}(%esp)
-; GISEL-X86-NEXT:    calll powl
-; GISEL-X86-NEXT:    addl $28, %esp
-; GISEL-X86-NEXT:    retl
-;
-; GISEL-X64-LABEL: pow_f80:
-; GISEL-X64:       # %bb.0:
-; GISEL-X64-NEXT:    subq $40, %rsp
-; GISEL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT:    fld %st(0)
-; GISEL-...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list