-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X86][CodeGen] Restrict F128 lowering to GNU environment #81664
Conversation
can you link to #79611 in the description? shouldn't this update |
yeah presubmit is complaining about it |
@llvm/pr-subscribers-backend-x86 Author: Pranav Kant (pranavk) ChangesOtherwise it breaks some environment like X64 Android that doesn't have f128 functions available in its libc. Patch is 42.79 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/81664.diff 3 Files Affected:
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");
diff --git a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
index 47234c365cad5f..f1d473f81a9fa1 100644
--- a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
+++ b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -O2 -mtriple=x86_64-linux-android \
; RUN: -enable-legalize-types-checking \
-; RUN: | FileCheck %s
+; RUN: | FileCheck %s --check-prefix=ANDROID
; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu \
; RUN: -enable-legalize-types-checking \
-; RUN: | FileCheck %s
+; RUN: | FileCheck %s --check-prefix=GNU
; RUN: llc < %s -O2 -mtriple=i686-linux-gnu -mattr=+sse2 \
; RUN: -enable-legalize-types-checking \
; RUN: | FileCheck %s --check-prefix=X86
@@ -19,6 +19,20 @@ define fp128 @add(fp128 %x, fp128 %y) nounwind strictfp {
; CHECK-NEXT: popq %rax
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: add:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq __addtf3@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: add:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq __addtf3@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
+;
; X86-LABEL: add:
; X86: # %bb.0: # %entry
; X86-NEXT: pushl %esi
@@ -56,6 +70,20 @@ define fp128 @sub(fp128 %x, fp128 %y) nounwind strictfp {
; CHECK-NEXT: popq %rax
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: sub:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq __subtf3@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: sub:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq __subtf3@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
+;
; X86-LABEL: sub:
; X86: # %bb.0: # %entry
; X86-NEXT: pushl %esi
@@ -93,6 +121,20 @@ define fp128 @mul(fp128 %x, fp128 %y) nounwind strictfp {
; CHECK-NEXT: popq %rax
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: mul:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq __multf3@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: mul:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq __multf3@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
+;
; X86-LABEL: mul:
; X86: # %bb.0: # %entry
; X86-NEXT: pushl %esi
@@ -130,6 +172,20 @@ define fp128 @div(fp128 %x, fp128 %y) nounwind strictfp {
; CHECK-NEXT: popq %rax
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: div:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq __divtf3@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: div:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq __divtf3@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
+;
; X86-LABEL: div:
; X86: # %bb.0: # %entry
; X86-NEXT: pushl %esi
@@ -160,12 +216,19 @@ entry:
}
define fp128 @fma(fp128 %x, fp128 %y, fp128 %z) nounwind strictfp {
-; CHECK-LABEL: fma:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq fmaf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: fma:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq fmal@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: fma:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq fmaf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: fma:
; X86: # %bb.0: # %entry
@@ -201,12 +264,19 @@ entry:
}
define fp128 @frem(fp128 %x, fp128 %y) nounwind strictfp {
-; CHECK-LABEL: frem:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq fmodf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: frem:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq fmodl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: frem:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq fmodf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: frem:
; X86: # %bb.0: # %entry
@@ -238,12 +308,19 @@ entry:
}
define fp128 @ceil(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: ceil:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq ceilf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: ceil:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq ceill@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: ceil:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq ceilf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: ceil:
; X86: # %bb.0: # %entry
@@ -271,12 +348,19 @@ entry:
}
define fp128 @cos(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: cos:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq cosf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: cos:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq cosl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: cos:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq cosf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: cos:
; X86: # %bb.0: # %entry
@@ -304,12 +388,19 @@ entry:
}
define fp128 @exp(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: exp:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq expf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: exp:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq expl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: exp:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq expf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: exp:
; X86: # %bb.0: # %entry
@@ -337,12 +428,19 @@ entry:
}
define fp128 @exp2(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: exp2:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq exp2f128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: exp2:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq exp2l@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: exp2:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq exp2f128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: exp2:
; X86: # %bb.0: # %entry
@@ -370,12 +468,19 @@ entry:
}
define fp128 @floor(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: floor:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq floorf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: floor:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq floorl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: floor:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq floorf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: floor:
; X86: # %bb.0: # %entry
@@ -403,12 +508,19 @@ entry:
}
define fp128 @log(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: log:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq logf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: log:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq logl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: log:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq logf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: log:
; X86: # %bb.0: # %entry
@@ -436,12 +548,19 @@ entry:
}
define fp128 @log10(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: log10:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq log10f128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: log10:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq log10l@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: log10:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq log10f128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: log10:
; X86: # %bb.0: # %entry
@@ -469,12 +588,19 @@ entry:
}
define fp128 @log2(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: log2:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq log2f128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: log2:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq log2l@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: log2:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq log2f128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: log2:
; X86: # %bb.0: # %entry
@@ -502,12 +628,19 @@ entry:
}
define fp128 @maxnum(fp128 %x, fp128 %y) nounwind strictfp {
-; CHECK-LABEL: maxnum:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq fmaxf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: maxnum:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq fmaxl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: maxnum:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq fmaxf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: maxnum:
; X86: # %bb.0: # %entry
@@ -539,12 +672,19 @@ entry:
}
define fp128 @minnum(fp128 %x, fp128 %y) nounwind strictfp {
-; CHECK-LABEL: minnum:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq fminf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: minnum:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq fminl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: minnum:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq fminf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: minnum:
; X86: # %bb.0: # %entry
@@ -576,12 +716,19 @@ entry:
}
define fp128 @nearbyint(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: nearbyint:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq nearbyintf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: nearbyint:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq nearbyintl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: nearbyint:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq nearbyintf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: nearbyint:
; X86: # %bb.0: # %entry
@@ -609,12 +756,19 @@ entry:
}
define fp128 @pow(fp128 %x, fp128 %y) nounwind strictfp {
-; CHECK-LABEL: pow:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq powf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: pow:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq powl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: pow:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq powf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: pow:
; X86: # %bb.0: # %entry
@@ -653,6 +807,20 @@ define fp128 @powi(fp128 %x, i32 %y) nounwind strictfp {
; CHECK-NEXT: popq %rax
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: powi:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq __powitf2@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: powi:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq __powitf2@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
+;
; X86-LABEL: powi:
; X86: # %bb.0: # %entry
; X86-NEXT: pushl %esi
@@ -680,12 +848,19 @@ entry:
}
define fp128 @rint(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: rint:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq rintf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: rint:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq rintl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: rint:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq rintf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: rint:
; X86: # %bb.0: # %entry
@@ -713,12 +888,19 @@ entry:
}
define fp128 @round(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: round:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq roundf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: round:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq roundl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: round:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq roundf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: round:
; X86: # %bb.0: # %entry
@@ -746,12 +928,19 @@ entry:
}
define fp128 @roundeven(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: roundeven:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq roundevenf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: roundeven:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq roundevenl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: roundeven:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq roundevenf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: roundeven:
; X86: # %bb.0: # %entry
@@ -779,12 +968,19 @@ entry:
}
define fp128 @sin(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: sin:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq sinf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: sin:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq sinl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: sin:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq sinf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: sin:
; X86: # %bb.0: # %entry
@@ -812,12 +1008,19 @@ entry:
}
define fp128 @sqrt(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: sqrt:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq sqrtf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: sqrt:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq sqrtl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: sqrt:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq sqrtf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: sqrt:
; X86: # %bb.0: # %entry
@@ -845,12 +1048,19 @@ entry:
}
define fp128 @trunc(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: trunc:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq truncf128
-; CHECK-NEXT: popq %rax
-; CHECK-NEXT: retq
+; ANDROID-LABEL: trunc:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq truncl@PLT
+; ANDROID-NEXT: popq %rax
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: trunc:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq truncf128@PLT
+; GNU-NEXT: popq %rax
+; GNU-NEXT: retq
;
; X86-LABEL: trunc:
; X86: # %bb.0: # %entry
@@ -878,12 +1088,19 @@ entry:
}
define i32 @lrint(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: lrint:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq lrintf128
-; CHECK-NEXT: popq %rcx
-; CHECK-NEXT: retq
+; ANDROID-LABEL: lrint:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq lrintl@PLT
+; ANDROID-NEXT: popq %rcx
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: lrint:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq lrintf128@PLT
+; GNU-NEXT: popq %rcx
+; GNU-NEXT: retq
;
; X86-LABEL: lrint:
; X86: # %bb.0: # %entry
@@ -901,12 +1118,19 @@ entry:
}
define i64 @llrint(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: llrint:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq llrintf128
-; CHECK-NEXT: popq %rcx
-; CHECK-NEXT: retq
+; ANDROID-LABEL: llrint:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq llrintl@PLT
+; ANDROID-NEXT: popq %rcx
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: llrint:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq llrintf128@PLT
+; GNU-NEXT: popq %rcx
+; GNU-NEXT: retq
;
; X86-LABEL: llrint:
; X86: # %bb.0: # %entry
@@ -924,12 +1148,19 @@ entry:
}
define i32 @lround(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: lround:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq lroundf128
-; CHECK-NEXT: popq %rcx
-; CHECK-NEXT: retq
+; ANDROID-LABEL: lround:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq lroundl@PLT
+; ANDROID-NEXT: popq %rcx
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: lround:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq lroundf128@PLT
+; GNU-NEXT: popq %rcx
+; GNU-NEXT: retq
;
; X86-LABEL: lround:
; X86: # %bb.0: # %entry
@@ -947,12 +1178,19 @@ entry:
}
define i64 @llround(fp128 %x) nounwind strictfp {
-; CHECK-LABEL: llround:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq %rax
-; CHECK-NEXT: callq llroundf128
-; CHECK-NEXT: popq %rcx
-; CHECK-NEXT: retq
+; ANDROID-LABEL: llround:
+; ANDROID: # %bb.0: # %entry
+; ANDROID-NEXT: pushq %rax
+; ANDROID-NEXT: callq llroundl@PLT
+; ANDROID-NEXT: popq %rcx
+; ANDROID-NEXT: retq
+;
+; GNU-LABEL: llround:
+; GNU: # %bb.0: # %entry
+; GNU-NEXT: pushq %rax
+; GNU-NEXT: callq llroundf128@PLT
+; GNU-NEXT: popq %rcx
+; GNU-NEXT: retq
;
; X86-LABEL: llround:
; X86: # %bb.0: # %entry
@@ -986,6 +1224,38 @@ define i64 @cmp(i64 %a, i64 %b, fp128 %x, fp128 %y) #0 {
; CHECK-NEXT: popq %r14
; CHECK-NEXT: retq
;
+; ANDROID-LABEL: cmp:
+; ANDROID: # %bb.0:
+; ANDROID-NEXT: pushq %r14
...
[truncated]
|
This change only makes sense if X64 Android actually uses f128 arithmetic rather than f80 arithmetic in the |
Yes, that is what I expect Android is doing right now which is breaking it. But I don't know where and if it can be easily fixed in Android. This PR is an effort to avoid reverting the original PR to unbreak Android build for now. |
https://godbolt.org/z/fhjEd3G4v shows that x64 Android uses f128 with |
Otherwise it breaks some environment like X64 Android that doesn't have f128 functions available in its libc.
Followup to #79611.