-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[SDAG] Remove most non-canonical libcall handing #171288
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
Conversation
|
@llvm/pr-subscribers-backend-systemz @llvm/pr-subscribers-backend-amdgpu Author: Nikita Popov (nikic) ChangesThis is a followup to #171114, removing the handling for most libcalls that are already canonicalized to intrinsics in the middle-end. The only remaining one is fabs, which has more test coverage than the others. Patch is 78.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171288.diff 22 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 71345509ea429..05aec6353f924 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9590,34 +9590,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FABS))
return;
break;
- case LibFunc_fmin:
- case LibFunc_fminf:
- case LibFunc_fminl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINNUM))
- return;
- break;
- case LibFunc_fmax:
- case LibFunc_fmaxf:
- case LibFunc_fmaxl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXNUM))
- return;
- break;
- case LibFunc_fminimum_num:
- case LibFunc_fminimum_numf:
- case LibFunc_fminimum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINIMUMNUM))
- return;
- break;
- case LibFunc_fmaximum_num:
- case LibFunc_fmaximum_numf:
- case LibFunc_fmaximum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXIMUMNUM))
- return;
- break;
case LibFunc_sin:
case LibFunc_sinf:
case LibFunc_sinl:
@@ -9687,41 +9659,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FSQRT))
return;
break;
- case LibFunc_floor:
- case LibFunc_floorf:
- case LibFunc_floorl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FFLOOR))
- return;
- break;
- case LibFunc_ceil:
- case LibFunc_ceilf:
- case LibFunc_ceill:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FCEIL))
- return;
- break;
- case LibFunc_rint:
- case LibFunc_rintf:
- case LibFunc_rintl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FRINT))
- return;
- break;
- case LibFunc_round:
- case LibFunc_roundf:
- case LibFunc_roundl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FROUND))
- return;
- break;
- case LibFunc_trunc:
- case LibFunc_truncf:
- case LibFunc_truncl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FTRUNC))
- return;
- break;
case LibFunc_log2:
case LibFunc_log2f:
case LibFunc_log2l:
diff --git a/llvm/test/CodeGen/AArch64/arm64-rounding.ll b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
index 618731fb001ca..7ade2fd497746 100644
--- a/llvm/test/CodeGen/AArch64/arm64-rounding.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
@@ -5,23 +5,19 @@
; CHECK-NOT: frintx
define float @test1(float %a) #0 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
-declare float @floorf(float) nounwind readnone
-
; CHECK-LABEL: test2:
; CHECK: frintm
; CHECK-NOT: frintx
define double @test2(double %a) #0 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
-declare double @floor(double) nounwind readnone
-
; CHECK-LABEL: test3:
; CHECK: frinti
define float @test3(float %a) #0 {
@@ -43,93 +39,77 @@ entry:
; CHECK-NOT: frintx
define float @test5(float %a) #0 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
-declare float @ceilf(float) nounwind readnone
-
; CHECK-LABEL: test6:
; CHECK: frintp
; CHECK-NOT: frintx
define double @test6(double %a) #0 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
-declare double @ceil(double) nounwind readnone
-
; CHECK-LABEL: test7:
; CHECK: frintx
define float @test7(float %a) #0 {
entry:
- %call = tail call float @rintf(float %a) nounwind readnone
+ %call = tail call float @llvm.rint.f32(float %a) nounwind readnone
ret float %call
}
-declare float @rintf(float) nounwind readnone
-
; CHECK-LABEL: test8:
; CHECK: frintx
define double @test8(double %a) #0 {
entry:
- %call = tail call double @rint(double %a) nounwind readnone
+ %call = tail call double @llvm.rint.f64(double %a) nounwind readnone
ret double %call
}
-declare double @rint(double) nounwind readnone
-
; CHECK-LABEL: test9:
; CHECK: frintz
; CHECK-NOT: frintx
define float @test9(float %a) #0 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
-declare float @truncf(float) nounwind readnone
-
; CHECK-LABEL: test10:
; CHECK: frintz
; CHECK-NOT: frintx
define double @test10(double %a) #0 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
-declare double @trunc(double) nounwind readnone
-
; CHECK-LABEL: test11:
; CHECK: frinta
; CHECK-NOT: frintx
define float @test11(float %a) #0 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
-declare float @roundf(float %a) nounwind readnone
-
; CHECK-LABEL: test12:
; CHECK: frinta
; CHECK-NOT: frintx
define double @test12(double %a) #0 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
-declare double @round(double %a) nounwind readnone
-
; CHECK-LABEL: test13:
; CHECK-NOT: frintx
; CHECK: frintm
define float @test13(float %a) #1 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
@@ -138,7 +118,7 @@ entry:
; CHECK: frintm
define double @test14(double %a) #1 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
@@ -147,7 +127,7 @@ entry:
; CHECK: frintp
define float @test15(float %a) #1 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
@@ -156,7 +136,7 @@ entry:
; CHECK: frintp
define double @test16(double %a) #1 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
@@ -165,7 +145,7 @@ entry:
; CHECK: frintz
define float @test17(float %a) #1 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
@@ -174,7 +154,7 @@ entry:
; CHECK: frintz
define double @test18(double %a) #1 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
@@ -183,7 +163,7 @@ entry:
; CHECK: frinta
define float @test19(float %a) #1 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
@@ -192,7 +172,7 @@ entry:
; CHECK: frinta
define double @test20(double %a) #1 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
diff --git a/llvm/test/CodeGen/AArch64/floatdp_1source.ll b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
index 8d1620d62ab01..32d73d9e830f8 100644
--- a/llvm/test/CodeGen/AArch64/floatdp_1source.ll
+++ b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
@@ -7,18 +7,6 @@ declare double @fabs(double) readonly
declare float @llvm.sqrt.f32(float %Val)
declare double @llvm.sqrt.f64(double %Val)
-declare float @ceilf(float) readonly
-declare double @ceil(double) readonly
-
-declare float @floorf(float) readonly
-declare double @floor(double) readonly
-
-declare float @truncf(float) readonly
-declare double @trunc(double) readonly
-
-declare float @rintf(float) readonly
-declare double @rint(double) readonly
-
define float @fabs_f(float %v) {
; CHECK-LABEL: fabs_f:
; CHECK: ; %bb.0:
@@ -51,7 +39,7 @@ define float @ceil_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp s0, s0
; CHECK-NEXT: ret
- %r = call float @ceilf(float %v)
+ %r = call float @llvm.ceil.f32(float %v)
ret float %r
}
@@ -60,7 +48,7 @@ define float @floor_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm s0, s0
; CHECK-NEXT: ret
- %r = call float @floorf(float %v)
+ %r = call float @llvm.floor.f32(float %v)
ret float %r
}
@@ -69,7 +57,7 @@ define float @trunc_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz s0, s0
; CHECK-NEXT: ret
- %r = call float @truncf(float %v)
+ %r = call float @llvm.trunc.f32(float %v)
ret float %r
}
@@ -78,7 +66,7 @@ define float @rint_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx s0, s0
; CHECK-NEXT: ret
- %r = call float @rintf(float %v)
+ %r = call float @llvm.rint.f32(float %v)
ret float %r
}
@@ -123,7 +111,7 @@ define double @ceil_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp d0, d0
; CHECK-NEXT: ret
- %r = call double @ceil(double %v)
+ %r = call double @llvm.ceil.f64(double %v)
ret double %r
}
@@ -132,7 +120,7 @@ define double @floor_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm d0, d0
; CHECK-NEXT: ret
- %r = call double @floor(double %v)
+ %r = call double @llvm.floor.f64(double %v)
ret double %r
}
@@ -141,7 +129,7 @@ define double @trunc_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz d0, d0
; CHECK-NEXT: ret
- %r = call double @trunc(double %v)
+ %r = call double @llvm.trunc.f64(double %v)
ret double %r
}
@@ -150,7 +138,7 @@ define double @rint_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx d0, d0
; CHECK-NEXT: ret
- %r = call double @rint(double %v)
+ %r = call double @llvm.rint.f64(double %v)
ret double %r
}
diff --git a/llvm/test/CodeGen/AArch64/round-conv.ll b/llvm/test/CodeGen/AArch64/round-conv.ll
index 5ed7d9409e3dd..d78aa207925a4 100644
--- a/llvm/test/CodeGen/AArch64/round-conv.ll
+++ b/llvm/test/CodeGen/AArch64/round-conv.ll
@@ -5,7 +5,7 @@
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmsws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -15,7 +15,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmsxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -25,7 +25,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmswd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -35,7 +35,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmsxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -45,7 +45,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmuws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -55,7 +55,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmuxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -65,7 +65,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmuwd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -75,7 +75,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmuxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -85,7 +85,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpsws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -95,7 +95,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpsxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -105,7 +105,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpswd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -115,7 +115,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpsxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -125,7 +125,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpuws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -135,7 +135,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpuxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -145,7 +145,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpuwd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -155,7 +155,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpuxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -165,7 +165,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzsws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -175,7 +175,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzsxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -185,7 +185,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzswd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -195,7 +195,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzsxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -205,7 +205,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzuws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -215,7 +215,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzuxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -225,7 +225,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzuwd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -235,7 +235,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzuxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -245,7 +245,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testasws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -255,7 +255,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testasxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -265,7 +265,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testaswd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -275,7 +275,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testasxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -285,7 +285,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testauws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -295,7 +295,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testauxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -305,7 +305,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testauwd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -315,16 +315,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testauxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%co...
[truncated]
|
|
@llvm/pr-subscribers-backend-arm Author: Nikita Popov (nikic) ChangesThis is a followup to #171114, removing the handling for most libcalls that are already canonicalized to intrinsics in the middle-end. The only remaining one is fabs, which has more test coverage than the others. Patch is 78.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171288.diff 22 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 71345509ea429..05aec6353f924 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9590,34 +9590,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FABS))
return;
break;
- case LibFunc_fmin:
- case LibFunc_fminf:
- case LibFunc_fminl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINNUM))
- return;
- break;
- case LibFunc_fmax:
- case LibFunc_fmaxf:
- case LibFunc_fmaxl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXNUM))
- return;
- break;
- case LibFunc_fminimum_num:
- case LibFunc_fminimum_numf:
- case LibFunc_fminimum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINIMUMNUM))
- return;
- break;
- case LibFunc_fmaximum_num:
- case LibFunc_fmaximum_numf:
- case LibFunc_fmaximum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXIMUMNUM))
- return;
- break;
case LibFunc_sin:
case LibFunc_sinf:
case LibFunc_sinl:
@@ -9687,41 +9659,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FSQRT))
return;
break;
- case LibFunc_floor:
- case LibFunc_floorf:
- case LibFunc_floorl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FFLOOR))
- return;
- break;
- case LibFunc_ceil:
- case LibFunc_ceilf:
- case LibFunc_ceill:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FCEIL))
- return;
- break;
- case LibFunc_rint:
- case LibFunc_rintf:
- case LibFunc_rintl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FRINT))
- return;
- break;
- case LibFunc_round:
- case LibFunc_roundf:
- case LibFunc_roundl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FROUND))
- return;
- break;
- case LibFunc_trunc:
- case LibFunc_truncf:
- case LibFunc_truncl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FTRUNC))
- return;
- break;
case LibFunc_log2:
case LibFunc_log2f:
case LibFunc_log2l:
diff --git a/llvm/test/CodeGen/AArch64/arm64-rounding.ll b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
index 618731fb001ca..7ade2fd497746 100644
--- a/llvm/test/CodeGen/AArch64/arm64-rounding.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
@@ -5,23 +5,19 @@
; CHECK-NOT: frintx
define float @test1(float %a) #0 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
-declare float @floorf(float) nounwind readnone
-
; CHECK-LABEL: test2:
; CHECK: frintm
; CHECK-NOT: frintx
define double @test2(double %a) #0 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
-declare double @floor(double) nounwind readnone
-
; CHECK-LABEL: test3:
; CHECK: frinti
define float @test3(float %a) #0 {
@@ -43,93 +39,77 @@ entry:
; CHECK-NOT: frintx
define float @test5(float %a) #0 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
-declare float @ceilf(float) nounwind readnone
-
; CHECK-LABEL: test6:
; CHECK: frintp
; CHECK-NOT: frintx
define double @test6(double %a) #0 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
-declare double @ceil(double) nounwind readnone
-
; CHECK-LABEL: test7:
; CHECK: frintx
define float @test7(float %a) #0 {
entry:
- %call = tail call float @rintf(float %a) nounwind readnone
+ %call = tail call float @llvm.rint.f32(float %a) nounwind readnone
ret float %call
}
-declare float @rintf(float) nounwind readnone
-
; CHECK-LABEL: test8:
; CHECK: frintx
define double @test8(double %a) #0 {
entry:
- %call = tail call double @rint(double %a) nounwind readnone
+ %call = tail call double @llvm.rint.f64(double %a) nounwind readnone
ret double %call
}
-declare double @rint(double) nounwind readnone
-
; CHECK-LABEL: test9:
; CHECK: frintz
; CHECK-NOT: frintx
define float @test9(float %a) #0 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
-declare float @truncf(float) nounwind readnone
-
; CHECK-LABEL: test10:
; CHECK: frintz
; CHECK-NOT: frintx
define double @test10(double %a) #0 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
-declare double @trunc(double) nounwind readnone
-
; CHECK-LABEL: test11:
; CHECK: frinta
; CHECK-NOT: frintx
define float @test11(float %a) #0 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
-declare float @roundf(float %a) nounwind readnone
-
; CHECK-LABEL: test12:
; CHECK: frinta
; CHECK-NOT: frintx
define double @test12(double %a) #0 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
-declare double @round(double %a) nounwind readnone
-
; CHECK-LABEL: test13:
; CHECK-NOT: frintx
; CHECK: frintm
define float @test13(float %a) #1 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
@@ -138,7 +118,7 @@ entry:
; CHECK: frintm
define double @test14(double %a) #1 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
@@ -147,7 +127,7 @@ entry:
; CHECK: frintp
define float @test15(float %a) #1 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
@@ -156,7 +136,7 @@ entry:
; CHECK: frintp
define double @test16(double %a) #1 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
@@ -165,7 +145,7 @@ entry:
; CHECK: frintz
define float @test17(float %a) #1 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
@@ -174,7 +154,7 @@ entry:
; CHECK: frintz
define double @test18(double %a) #1 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
@@ -183,7 +163,7 @@ entry:
; CHECK: frinta
define float @test19(float %a) #1 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
@@ -192,7 +172,7 @@ entry:
; CHECK: frinta
define double @test20(double %a) #1 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
diff --git a/llvm/test/CodeGen/AArch64/floatdp_1source.ll b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
index 8d1620d62ab01..32d73d9e830f8 100644
--- a/llvm/test/CodeGen/AArch64/floatdp_1source.ll
+++ b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
@@ -7,18 +7,6 @@ declare double @fabs(double) readonly
declare float @llvm.sqrt.f32(float %Val)
declare double @llvm.sqrt.f64(double %Val)
-declare float @ceilf(float) readonly
-declare double @ceil(double) readonly
-
-declare float @floorf(float) readonly
-declare double @floor(double) readonly
-
-declare float @truncf(float) readonly
-declare double @trunc(double) readonly
-
-declare float @rintf(float) readonly
-declare double @rint(double) readonly
-
define float @fabs_f(float %v) {
; CHECK-LABEL: fabs_f:
; CHECK: ; %bb.0:
@@ -51,7 +39,7 @@ define float @ceil_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp s0, s0
; CHECK-NEXT: ret
- %r = call float @ceilf(float %v)
+ %r = call float @llvm.ceil.f32(float %v)
ret float %r
}
@@ -60,7 +48,7 @@ define float @floor_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm s0, s0
; CHECK-NEXT: ret
- %r = call float @floorf(float %v)
+ %r = call float @llvm.floor.f32(float %v)
ret float %r
}
@@ -69,7 +57,7 @@ define float @trunc_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz s0, s0
; CHECK-NEXT: ret
- %r = call float @truncf(float %v)
+ %r = call float @llvm.trunc.f32(float %v)
ret float %r
}
@@ -78,7 +66,7 @@ define float @rint_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx s0, s0
; CHECK-NEXT: ret
- %r = call float @rintf(float %v)
+ %r = call float @llvm.rint.f32(float %v)
ret float %r
}
@@ -123,7 +111,7 @@ define double @ceil_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp d0, d0
; CHECK-NEXT: ret
- %r = call double @ceil(double %v)
+ %r = call double @llvm.ceil.f64(double %v)
ret double %r
}
@@ -132,7 +120,7 @@ define double @floor_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm d0, d0
; CHECK-NEXT: ret
- %r = call double @floor(double %v)
+ %r = call double @llvm.floor.f64(double %v)
ret double %r
}
@@ -141,7 +129,7 @@ define double @trunc_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz d0, d0
; CHECK-NEXT: ret
- %r = call double @trunc(double %v)
+ %r = call double @llvm.trunc.f64(double %v)
ret double %r
}
@@ -150,7 +138,7 @@ define double @rint_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx d0, d0
; CHECK-NEXT: ret
- %r = call double @rint(double %v)
+ %r = call double @llvm.rint.f64(double %v)
ret double %r
}
diff --git a/llvm/test/CodeGen/AArch64/round-conv.ll b/llvm/test/CodeGen/AArch64/round-conv.ll
index 5ed7d9409e3dd..d78aa207925a4 100644
--- a/llvm/test/CodeGen/AArch64/round-conv.ll
+++ b/llvm/test/CodeGen/AArch64/round-conv.ll
@@ -5,7 +5,7 @@
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmsws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -15,7 +15,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmsxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -25,7 +25,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmswd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -35,7 +35,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmsxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -45,7 +45,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmuws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -55,7 +55,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmuxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -65,7 +65,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmuwd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -75,7 +75,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmuxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -85,7 +85,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpsws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -95,7 +95,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpsxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -105,7 +105,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpswd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -115,7 +115,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpsxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -125,7 +125,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpuws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -135,7 +135,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpuxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -145,7 +145,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpuwd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -155,7 +155,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpuxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -165,7 +165,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzsws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -175,7 +175,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzsxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -185,7 +185,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzswd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -195,7 +195,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzsxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -205,7 +205,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzuws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -215,7 +215,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzuxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -225,7 +225,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzuwd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -235,7 +235,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzuxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -245,7 +245,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testasws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -255,7 +255,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testasxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -265,7 +265,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testaswd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -275,7 +275,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testasxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -285,7 +285,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testauws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -295,7 +295,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testauxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -305,7 +305,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testauwd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -315,16 +315,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testauxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%co...
[truncated]
|
|
@llvm/pr-subscribers-backend-x86 Author: Nikita Popov (nikic) ChangesThis is a followup to #171114, removing the handling for most libcalls that are already canonicalized to intrinsics in the middle-end. The only remaining one is fabs, which has more test coverage than the others. Patch is 78.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171288.diff 22 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 71345509ea429..05aec6353f924 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9590,34 +9590,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FABS))
return;
break;
- case LibFunc_fmin:
- case LibFunc_fminf:
- case LibFunc_fminl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINNUM))
- return;
- break;
- case LibFunc_fmax:
- case LibFunc_fmaxf:
- case LibFunc_fmaxl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXNUM))
- return;
- break;
- case LibFunc_fminimum_num:
- case LibFunc_fminimum_numf:
- case LibFunc_fminimum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMINIMUMNUM))
- return;
- break;
- case LibFunc_fmaximum_num:
- case LibFunc_fmaximum_numf:
- case LibFunc_fmaximum_numl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitBinaryFloatCall(I, ISD::FMAXIMUMNUM))
- return;
- break;
case LibFunc_sin:
case LibFunc_sinf:
case LibFunc_sinl:
@@ -9687,41 +9659,6 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
if (visitUnaryFloatCall(I, ISD::FSQRT))
return;
break;
- case LibFunc_floor:
- case LibFunc_floorf:
- case LibFunc_floorl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FFLOOR))
- return;
- break;
- case LibFunc_ceil:
- case LibFunc_ceilf:
- case LibFunc_ceill:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FCEIL))
- return;
- break;
- case LibFunc_rint:
- case LibFunc_rintf:
- case LibFunc_rintl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FRINT))
- return;
- break;
- case LibFunc_round:
- case LibFunc_roundf:
- case LibFunc_roundl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FROUND))
- return;
- break;
- case LibFunc_trunc:
- case LibFunc_truncf:
- case LibFunc_truncl:
- // TODO: Remove this, already canonicalized by the middle-end.
- if (visitUnaryFloatCall(I, ISD::FTRUNC))
- return;
- break;
case LibFunc_log2:
case LibFunc_log2f:
case LibFunc_log2l:
diff --git a/llvm/test/CodeGen/AArch64/arm64-rounding.ll b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
index 618731fb001ca..7ade2fd497746 100644
--- a/llvm/test/CodeGen/AArch64/arm64-rounding.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-rounding.ll
@@ -5,23 +5,19 @@
; CHECK-NOT: frintx
define float @test1(float %a) #0 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
-declare float @floorf(float) nounwind readnone
-
; CHECK-LABEL: test2:
; CHECK: frintm
; CHECK-NOT: frintx
define double @test2(double %a) #0 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
-declare double @floor(double) nounwind readnone
-
; CHECK-LABEL: test3:
; CHECK: frinti
define float @test3(float %a) #0 {
@@ -43,93 +39,77 @@ entry:
; CHECK-NOT: frintx
define float @test5(float %a) #0 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
-declare float @ceilf(float) nounwind readnone
-
; CHECK-LABEL: test6:
; CHECK: frintp
; CHECK-NOT: frintx
define double @test6(double %a) #0 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
-declare double @ceil(double) nounwind readnone
-
; CHECK-LABEL: test7:
; CHECK: frintx
define float @test7(float %a) #0 {
entry:
- %call = tail call float @rintf(float %a) nounwind readnone
+ %call = tail call float @llvm.rint.f32(float %a) nounwind readnone
ret float %call
}
-declare float @rintf(float) nounwind readnone
-
; CHECK-LABEL: test8:
; CHECK: frintx
define double @test8(double %a) #0 {
entry:
- %call = tail call double @rint(double %a) nounwind readnone
+ %call = tail call double @llvm.rint.f64(double %a) nounwind readnone
ret double %call
}
-declare double @rint(double) nounwind readnone
-
; CHECK-LABEL: test9:
; CHECK: frintz
; CHECK-NOT: frintx
define float @test9(float %a) #0 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
-declare float @truncf(float) nounwind readnone
-
; CHECK-LABEL: test10:
; CHECK: frintz
; CHECK-NOT: frintx
define double @test10(double %a) #0 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
-declare double @trunc(double) nounwind readnone
-
; CHECK-LABEL: test11:
; CHECK: frinta
; CHECK-NOT: frintx
define float @test11(float %a) #0 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
-declare float @roundf(float %a) nounwind readnone
-
; CHECK-LABEL: test12:
; CHECK: frinta
; CHECK-NOT: frintx
define double @test12(double %a) #0 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
-declare double @round(double %a) nounwind readnone
-
; CHECK-LABEL: test13:
; CHECK-NOT: frintx
; CHECK: frintm
define float @test13(float %a) #1 {
entry:
- %call = tail call float @floorf(float %a) nounwind readnone
+ %call = tail call float @llvm.floor.f32(float %a) nounwind readnone
ret float %call
}
@@ -138,7 +118,7 @@ entry:
; CHECK: frintm
define double @test14(double %a) #1 {
entry:
- %call = tail call double @floor(double %a) nounwind readnone
+ %call = tail call double @llvm.floor.f64(double %a) nounwind readnone
ret double %call
}
@@ -147,7 +127,7 @@ entry:
; CHECK: frintp
define float @test15(float %a) #1 {
entry:
- %call = tail call float @ceilf(float %a) nounwind readnone
+ %call = tail call float @llvm.ceil.f32(float %a) nounwind readnone
ret float %call
}
@@ -156,7 +136,7 @@ entry:
; CHECK: frintp
define double @test16(double %a) #1 {
entry:
- %call = tail call double @ceil(double %a) nounwind readnone
+ %call = tail call double @llvm.ceil.f64(double %a) nounwind readnone
ret double %call
}
@@ -165,7 +145,7 @@ entry:
; CHECK: frintz
define float @test17(float %a) #1 {
entry:
- %call = tail call float @truncf(float %a) nounwind readnone
+ %call = tail call float @llvm.trunc.f32(float %a) nounwind readnone
ret float %call
}
@@ -174,7 +154,7 @@ entry:
; CHECK: frintz
define double @test18(double %a) #1 {
entry:
- %call = tail call double @trunc(double %a) nounwind readnone
+ %call = tail call double @llvm.trunc.f64(double %a) nounwind readnone
ret double %call
}
@@ -183,7 +163,7 @@ entry:
; CHECK: frinta
define float @test19(float %a) #1 {
entry:
- %call = tail call float @roundf(float %a) nounwind readnone
+ %call = tail call float @llvm.round.f32(float %a) nounwind readnone
ret float %call
}
@@ -192,7 +172,7 @@ entry:
; CHECK: frinta
define double @test20(double %a) #1 {
entry:
- %call = tail call double @round(double %a) nounwind readnone
+ %call = tail call double @llvm.round.f64(double %a) nounwind readnone
ret double %call
}
diff --git a/llvm/test/CodeGen/AArch64/floatdp_1source.ll b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
index 8d1620d62ab01..32d73d9e830f8 100644
--- a/llvm/test/CodeGen/AArch64/floatdp_1source.ll
+++ b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
@@ -7,18 +7,6 @@ declare double @fabs(double) readonly
declare float @llvm.sqrt.f32(float %Val)
declare double @llvm.sqrt.f64(double %Val)
-declare float @ceilf(float) readonly
-declare double @ceil(double) readonly
-
-declare float @floorf(float) readonly
-declare double @floor(double) readonly
-
-declare float @truncf(float) readonly
-declare double @trunc(double) readonly
-
-declare float @rintf(float) readonly
-declare double @rint(double) readonly
-
define float @fabs_f(float %v) {
; CHECK-LABEL: fabs_f:
; CHECK: ; %bb.0:
@@ -51,7 +39,7 @@ define float @ceil_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp s0, s0
; CHECK-NEXT: ret
- %r = call float @ceilf(float %v)
+ %r = call float @llvm.ceil.f32(float %v)
ret float %r
}
@@ -60,7 +48,7 @@ define float @floor_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm s0, s0
; CHECK-NEXT: ret
- %r = call float @floorf(float %v)
+ %r = call float @llvm.floor.f32(float %v)
ret float %r
}
@@ -69,7 +57,7 @@ define float @trunc_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz s0, s0
; CHECK-NEXT: ret
- %r = call float @truncf(float %v)
+ %r = call float @llvm.trunc.f32(float %v)
ret float %r
}
@@ -78,7 +66,7 @@ define float @rint_f(float %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx s0, s0
; CHECK-NEXT: ret
- %r = call float @rintf(float %v)
+ %r = call float @llvm.rint.f32(float %v)
ret float %r
}
@@ -123,7 +111,7 @@ define double @ceil_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintp d0, d0
; CHECK-NEXT: ret
- %r = call double @ceil(double %v)
+ %r = call double @llvm.ceil.f64(double %v)
ret double %r
}
@@ -132,7 +120,7 @@ define double @floor_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintm d0, d0
; CHECK-NEXT: ret
- %r = call double @floor(double %v)
+ %r = call double @llvm.floor.f64(double %v)
ret double %r
}
@@ -141,7 +129,7 @@ define double @trunc_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintz d0, d0
; CHECK-NEXT: ret
- %r = call double @trunc(double %v)
+ %r = call double @llvm.trunc.f64(double %v)
ret double %r
}
@@ -150,7 +138,7 @@ define double @rint_d(double %v) {
; CHECK: ; %bb.0:
; CHECK-NEXT: frintx d0, d0
; CHECK-NEXT: ret
- %r = call double @rint(double %v)
+ %r = call double @llvm.rint.f64(double %v)
ret double %r
}
diff --git a/llvm/test/CodeGen/AArch64/round-conv.ll b/llvm/test/CodeGen/AArch64/round-conv.ll
index 5ed7d9409e3dd..d78aa207925a4 100644
--- a/llvm/test/CodeGen/AArch64/round-conv.ll
+++ b/llvm/test/CodeGen/AArch64/round-conv.ll
@@ -5,7 +5,7 @@
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmsws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -15,7 +15,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmsxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -25,7 +25,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmswd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -35,7 +35,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmsxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -45,7 +45,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testmuws(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -55,7 +55,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testmuxs(float %a) {
entry:
- %call = call float @floorf(float %a) nounwind readnone
+ %call = call float @llvm.floor.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -65,7 +65,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testmuwd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -75,7 +75,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testmuxd(double %a) {
entry:
- %call = call double @floor(double %a) nounwind readnone
+ %call = call double @llvm.floor.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -85,7 +85,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpsws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -95,7 +95,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpsxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -105,7 +105,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpswd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -115,7 +115,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpsxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -125,7 +125,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testpuws(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -135,7 +135,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testpuxs(float %a) {
entry:
- %call = call float @ceilf(float %a) nounwind readnone
+ %call = call float @llvm.ceil.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -145,7 +145,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testpuwd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -155,7 +155,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testpuxd(double %a) {
entry:
- %call = call double @ceil(double %a) nounwind readnone
+ %call = call double @llvm.ceil.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -165,7 +165,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzsws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -175,7 +175,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzsxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -185,7 +185,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzswd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -195,7 +195,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzsxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -205,7 +205,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testzuws(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -215,7 +215,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testzuxs(float %a) {
entry:
- %call = call float @truncf(float %a) nounwind readnone
+ %call = call float @llvm.trunc.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -225,7 +225,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testzuwd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -235,7 +235,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testzuxd(double %a) {
entry:
- %call = call double @trunc(double %a) nounwind readnone
+ %call = call double @llvm.trunc.f64(double %a) nounwind readnone
%conv = fptoui double %call to i64
ret i64 %conv
}
@@ -245,7 +245,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testasws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i32
ret i32 %conv
}
@@ -255,7 +255,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testasxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptosi float %call to i64
ret i64 %conv
}
@@ -265,7 +265,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testaswd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i32
ret i32 %conv
}
@@ -275,7 +275,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testasxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptosi double %call to i64
ret i64 %conv
}
@@ -285,7 +285,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i32 @testauws(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i32
ret i32 %conv
}
@@ -295,7 +295,7 @@ entry:
; CHECK-NOT: frintx {{s[0-9]+}}, s0
define i64 @testauxs(float %a) {
entry:
- %call = call float @roundf(float %a) nounwind readnone
+ %call = call float @llvm.round.f32(float %a) nounwind readnone
%conv = fptoui float %call to i64
ret i64 %conv
}
@@ -305,7 +305,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i32 @testauwd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%conv = fptoui double %call to i32
ret i32 %conv
}
@@ -315,16 +315,7 @@ entry:
; CHECK-NOT: frintx {{d[0-9]+}}, d0
define i64 @testauxd(double %a) {
entry:
- %call = call double @round(double %a) nounwind readnone
+ %call = call double @llvm.round.f64(double %a) nounwind readnone
%co...
[truncated]
|
arsenm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There
| declare fp128 @llvm.maximum.f128(fp128, fp128) | ||
|
|
||
| ; Test the fmax library function. | ||
| define double @f1(double %dummy, double %val1, double %val2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing the background here, but why do we need to remove these tests? Shouldn't this still work as before, no matter where exactly the lowering of fmax etc takes place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file already has separate tests for the intrinsics, so I did not convert the libcalls to intrinsics as in most other tests.
I have also left some libcalls in other tests (e.g. the see X86 ones below) to have some coverage for the "do nothing" libcall lowering, but I don't think we need those for each target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR to keep these tests and show the new codegen instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so this means fmax is not actually handled at all anymore? I thought we'd still get the same codegen, just the handling is now done earlier? Where does the translation from the library call to the intrinsic happen now, and why don't we see it in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens in the middle-end: https://llvm.godbolt.org/z/PczTGE6Pz
Backend tests do not run the middle-end pipeline, they expect to work on already canonical IR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it now, thanks! That seem fine to me.
f2132ca to
f596ebc
Compare
llvm#171288 changed the tests to call into floating-point intrinsics instead of libcalls, and these attributes are already implied.
llvm/llvm-project#171288 removed the SDAG lowering for ceil/ceilf calls. This was causing some errors for us when using webassembly: Internal Error at third_party/halide/halide/src/WasmExecutor.cpp:2368 Condition failed: instance: Error initializing module: invalid import "env.ceilf" Explicitly using the intrinsics is still covered by webassembly and given the commenting out of these intrinsics mentions that they were not used due to needing to support LLVM <3.3, I think we can safely enable these now.
The fast instruction selector should should not force an SDAG fallback to potentially make use of optimized libcall implementations. Looking at 3e6fa46, part of the motivation was to avoid libcalls in unoptimized builds for targets that don't have them, but I believe this should be handled by Clang directly emitting intrinsics instead of libcalls (which it already does). FastISel should not second guess this. Followup to #171288.
The fast instruction selector should should not force an SDAG fallback to potentially make use of optimized libcall implementations. Looking at llvm/llvm-project@3e6fa46, part of the motivation was to avoid libcalls in unoptimized builds for targets that don't have them, but I believe this should be handled by Clang directly emitting intrinsics instead of libcalls (which it already does). FastISel should not second guess this. Followup to llvm/llvm-project#171288.
llvm/llvm-project#171288 removed the SDAG lowering for ceil/ceilf calls. This was causing some errors for us when using webassembly: Internal Error at third_party/halide/halide/src/WasmExecutor.cpp:2368 Condition failed: instance: Error initializing module: invalid import "env.ceilf" Explicitly using the intrinsics is still covered by webassembly and given the commenting out of these intrinsics mentions that they were not used due to needing to support LLVM <3.3, I think we can safely enable these now.
This is a followup to #171114, removing the handling for most libcalls that are already canonicalized to intrinsics in the middle-end. The only remaining one is fabs, which has more test coverage than the others.