[llvm] [X86][CodeGen] Restrict F128 lowering to GNU environment (PR #81664)

Pranav Kant via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 13:20:19 PST 2024


https://github.com/pranavk created https://github.com/llvm/llvm-project/pull/81664

Otherwise it breaks some environment like X64 Android that doesn't have f128 functions available in its libc.

>From e64d5e9c8d2d4478b49cf452bf7096f4bf8a8e55 Mon Sep 17 00:00:00 2001
From: Pranav Kant <prka at google.com>
Date: Tue, 13 Feb 2024 21:19:08 +0000
Subject: [PATCH] [X86][CodeGen] Restrict F128 lowering to GNU environment

---
 llvm/lib/CodeGen/TargetLoweringBase.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index dc766928e5dc94..646c0c345e54e0 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -123,7 +123,7 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT) {
     setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C);
 
   // Use the f128 variants of math functions on x86_64
-  if (TT.getArch() == Triple::ArchType::x86_64) {
+  if (TT.getArch() == Triple::ArchType::x86_64 && TT.isGNUEnvironment()) {
     setLibcallName(RTLIB::REM_F128, "fmodf128");
     setLibcallName(RTLIB::FMA_F128, "fmaf128");
     setLibcallName(RTLIB::SQRT_F128, "sqrtf128");



More information about the llvm-commits mailing list