[llvm] 02b3a35 - [InstSimplify] fold FP rounding intrinsic with rounded operand
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 31 07:00:41 PDT 2022
Author: Sanjay Patel
Date: 2022-07-31T10:00:27-04:00
New Revision: 02b3a358926e7bbcac9226cbecbfc3067c2ad61b
URL: https://github.com/llvm/llvm-project/commit/02b3a358926e7bbcac9226cbecbfc3067c2ad61b
DIFF: https://github.com/llvm/llvm-project/commit/02b3a358926e7bbcac9226cbecbfc3067c2ad61b.diff
LOG: [InstSimplify] fold FP rounding intrinsic with rounded operand
issue #56775
I rearranged the Thumb2 codegen test to avoid simplifying the chain
of rounding instructions. I'm assuming the intent of the test is
to verify lowering of each of those intrinsics.
Added:
Modified:
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll
llvm/test/Transforms/InstSimplify/round-intrinsics.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 21fe448218bc7..3c3d9656cc01b 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -5573,6 +5573,24 @@ static bool isIdempotent(Intrinsic::ID ID) {
}
}
+/// Return true if the intrinsic rounds a floating-point value to an integral
+/// floating-point value (not an integer type).
+static bool removesFPFraction(Intrinsic::ID ID) {
+ switch (ID) {
+ default:
+ return false;
+
+ case Intrinsic::floor:
+ case Intrinsic::ceil:
+ case Intrinsic::trunc:
+ case Intrinsic::rint:
+ case Intrinsic::nearbyint:
+ case Intrinsic::round:
+ case Intrinsic::roundeven:
+ return true;
+ }
+}
+
static Value *simplifyRelativeLoad(Constant *Ptr, Constant *Offset,
const DataLayout &DL) {
GlobalValue *PtrSym;
@@ -5638,6 +5656,18 @@ static Value *simplifyUnaryIntrinsic(Function *F, Value *Op0,
if (II->getIntrinsicID() == IID)
return II;
+ if (removesFPFraction(IID)) {
+ // Converting from int or calling a rounding function always results in a
+ // finite integral number or infinity. For those inputs, rounding functions
+ // always return the same value, so the (2nd) rounding is eliminated. Ex:
+ // floor (sitofp x) -> sitofp x
+ // round (ceil x) -> ceil x
+ auto *II = dyn_cast<IntrinsicInst>(Op0);
+ if ((II && removesFPFraction(II->getIntrinsicID())) ||
+ match(Op0, m_SIToFP(m_Value())) || match(Op0, m_UIToFP(m_Value())))
+ return Op0;
+ }
+
Value *X;
switch (IID) {
case Intrinsic::fabs:
@@ -5695,23 +5725,6 @@ static Value *simplifyUnaryIntrinsic(Function *F, Value *Op0,
match(Op0, m_Intrinsic<Intrinsic::pow>(m_SpecificFP(10.0), m_Value(X))))
return X;
break;
- case Intrinsic::floor:
- case Intrinsic::trunc:
- case Intrinsic::ceil:
- case Intrinsic::round:
- case Intrinsic::roundeven:
- case Intrinsic::nearbyint:
- case Intrinsic::rint: {
- // floor (sitofp x) -> sitofp x
- // floor (uitofp x) -> uitofp x
- //
- // Converting from int always results in a finite integral number or
- // infinity. For either of those inputs, these rounding functions always
- // return the same value, so the rounding can be eliminated.
- if (match(Op0, m_SIToFP(m_Value())) || match(Op0, m_UIToFP(m_Value())))
- return Op0;
- break;
- }
case Intrinsic::experimental_vector_reverse:
// experimental.vector.reverse(experimental.vector.reverse(x)) -> x
if (match(Op0,
diff --git a/llvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll b/llvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll
index 879351b07b425..86229880e480d 100644
--- a/llvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll
+++ b/llvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll
@@ -578,46 +578,46 @@ entry:
define arm_aapcs_vfpcc <8 x half> @ext_fpintrinsics_trunc_half(<8 x half> %a, <8 x half> %b) {
; CHECK-LABEL: ext_fpintrinsics_trunc_half:
; CHECK: @ %bb.0: @ %entry
-; CHECK-NEXT: .vsave {d8, d9}
-; CHECK-NEXT: vpush {d8, d9}
+; CHECK-NEXT: .vsave {d8, d9, d10, d11}
+; CHECK-NEXT: vpush {d8, d9, d10, d11}
; CHECK-NEXT: vcvtb.f32.f16 q2, q0
; CHECK-NEXT: vcvtb.f32.f16 q4, q1
-; CHECK-NEXT: vabs.f32 q3, q2
-; CHECK-NEXT: vcvtt.f32.f16 q0, q0
+; CHECK-NEXT: vrintm.f32 q3, q2
+; CHECK-NEXT: vrintx.f32 q5, q4
+; CHECK-NEXT: vabs.f32 q3, q3
+; CHECK-NEXT: vrinta.f32 q4, q4
; CHECK-NEXT: vminnm.f32 q3, q3, q2
+; CHECK-NEXT: vrintp.f32 q2, q2
+; CHECK-NEXT: vmaxnm.f32 q3, q3, q5
+; CHECK-NEXT: vcvtt.f32.f16 q0, q0
+; CHECK-NEXT: vfma.f32 q2, q3, q4
+; CHECK-NEXT: vrintm.f32 q3, q0
+; CHECK-NEXT: vabs.f32 q3, q3
; CHECK-NEXT: vcvtt.f32.f16 q1, q1
-; CHECK-NEXT: vmaxnm.f32 q3, q3, q4
-; CHECK-NEXT: vfma.f32 q4, q3, q2
-; CHECK-NEXT: vabs.f32 q3, q0
; CHECK-NEXT: vminnm.f32 q3, q3, q0
-; CHECK-NEXT: vrintp.f32 q2, q4
-; CHECK-NEXT: vmaxnm.f32 q3, q3, q1
-; CHECK-NEXT: vrintm.f32 q2, q2
-; CHECK-NEXT: vfma.f32 q1, q3, q0
-; CHECK-NEXT: vrintx.f32 q2, q2
-; CHECK-NEXT: vrintp.f32 q0, q1
-; CHECK-NEXT: vrinta.f32 q2, q2
-; CHECK-NEXT: vrintm.f32 q0, q0
+; CHECK-NEXT: vrintx.f32 q4, q1
+; CHECK-NEXT: vmaxnm.f32 q3, q3, q4
+; CHECK-NEXT: vrinta.f32 q1, q1
+; CHECK-NEXT: vrintp.f32 q0, q0
; CHECK-NEXT: vrintz.f32 q2, q2
-; CHECK-NEXT: vrintx.f32 q0, q0
-; CHECK-NEXT: vrinta.f32 q0, q0
+; CHECK-NEXT: vfma.f32 q0, q3, q1
; CHECK-NEXT: vrintz.f32 q1, q0
; CHECK-NEXT: vcvtb.f16.f32 q0, q2
; CHECK-NEXT: vcvtt.f16.f32 q0, q1
-; CHECK-NEXT: vpop {d8, d9}
+; CHECK-NEXT: vpop {d8, d9, d10, d11}
; CHECK-NEXT: bx lr
entry:
%sa = fpext <8 x half> %a to <8 x float>
%sb = fpext <8 x half> %b to <8 x float>
- %abs = call <8 x float> @llvm.fabs.v8f32(<8 x float> %sa)
+ %floor = call <8 x float> @llvm.floor.v8f32(<8 x float> %sa)
+ %rint = call <8 x float> @llvm.rint.v8f32(<8 x float> %sb)
+ %ceil = call <8 x float> @llvm.ceil.v8f32(<8 x float> %sa)
+ %round = call <8 x float> @llvm.round.v8f32(<8 x float> %sb)
+ %abs = call <8 x float> @llvm.fabs.v8f32(<8 x float> %floor)
%min = call <8 x float> @llvm.minnum.v8f32(<8 x float> %abs, <8 x float> %sa)
- %max = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %min, <8 x float> %sb)
- %fma = call <8 x float> @llvm.fma.v8f32(<8 x float> %max, <8 x float> %sa, <8 x float> %sb)
- %ceil = call <8 x float> @llvm.ceil.v8f32(<8 x float> %fma)
- %floor = call <8 x float> @llvm.floor.v8f32(<8 x float> %ceil)
- %rint = call <8 x float> @llvm.rint.v8f32(<8 x float> %floor)
- %round = call <8 x float> @llvm.round.v8f32(<8 x float> %rint)
- %trunc = call <8 x float> @llvm.trunc.v8f32(<8 x float> %round)
+ %max = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %min, <8 x float> %rint)
+ %fma = call <8 x float> @llvm.fma.v8f32(<8 x float> %max, <8 x float> %round, <8 x float> %ceil)
+ %trunc = call <8 x float> @llvm.trunc.v8f32(<8 x float> %fma)
%t = fptrunc <8 x float> %trunc to <8 x half>
ret <8 x half> %t
}
diff --git a/llvm/test/Transforms/InstSimplify/round-intrinsics.ll b/llvm/test/Transforms/InstSimplify/round-intrinsics.ll
index fc8d1e64c5326..cf48a8c1c89d6 100644
--- a/llvm/test/Transforms/InstSimplify/round-intrinsics.ll
+++ b/llvm/test/Transforms/InstSimplify/round-intrinsics.ll
@@ -134,8 +134,7 @@ define float @uitofp_rint(i32 %arg) {
define float @floor_trunc(float %x) {
; CHECK-LABEL: @floor_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -145,8 +144,7 @@ define float @floor_trunc(float %x) {
define float @floor_ceil(float %x) {
; CHECK-LABEL: @floor_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -156,8 +154,7 @@ define float @floor_ceil(float %x) {
define float @floor_round(float %x) {
; CHECK-LABEL: @floor_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -167,8 +164,7 @@ define float @floor_round(float %x) {
define float @floor_roundeven(float %x) {
; CHECK-LABEL: @floor_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -178,8 +174,7 @@ define float @floor_roundeven(float %x) {
define float @floor_nearbyint(float %x) {
; CHECK-LABEL: @floor_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
@@ -189,8 +184,7 @@ define float @floor_nearbyint(float %x) {
define float @floor_rint(float %x) {
; CHECK-LABEL: @floor_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.floor.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -200,8 +194,7 @@ define float @floor_rint(float %x) {
define float @trunc_floor(float %x) {
; CHECK-LABEL: @trunc_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -211,8 +204,7 @@ define float @trunc_floor(float %x) {
define float @trunc_ceil(float %x) {
; CHECK-LABEL: @trunc_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -222,8 +214,7 @@ define float @trunc_ceil(float %x) {
define float @trunc_round(float %x) {
; CHECK-LABEL: @trunc_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -233,8 +224,7 @@ define float @trunc_round(float %x) {
define float @trunc_roundeven(float %x) {
; CHECK-LABEL: @trunc_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -244,8 +234,7 @@ define float @trunc_roundeven(float %x) {
define float @trunc_nearbyint(float %x) {
; CHECK-LABEL: @trunc_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
@@ -255,8 +244,7 @@ define float @trunc_nearbyint(float %x) {
define float @trunc_rint(float %x) {
; CHECK-LABEL: @trunc_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.trunc.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.trunc.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -266,8 +254,7 @@ define float @trunc_rint(float %x) {
define float @ceil_floor(float %x) {
; CHECK-LABEL: @ceil_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -277,8 +264,7 @@ define float @ceil_floor(float %x) {
define float @ceil_trunc(float %x) {
; CHECK-LABEL: @ceil_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -288,8 +274,7 @@ define float @ceil_trunc(float %x) {
define float @ceil_round(float %x) {
; CHECK-LABEL: @ceil_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -299,8 +284,7 @@ define float @ceil_round(float %x) {
define float @ceil_roundeven(float %x) {
; CHECK-LABEL: @ceil_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -310,8 +294,7 @@ define float @ceil_roundeven(float %x) {
define float @ceil_nearbyint(float %x) {
; CHECK-LABEL: @ceil_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
@@ -321,8 +304,7 @@ define float @ceil_nearbyint(float %x) {
define float @ceil_rint(float %x) {
; CHECK-LABEL: @ceil_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.ceil.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -332,8 +314,7 @@ define float @ceil_rint(float %x) {
define float @round_floor(float %x) {
; CHECK-LABEL: @round_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -343,8 +324,7 @@ define float @round_floor(float %x) {
define float @round_trunc(float %x) {
; CHECK-LABEL: @round_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -354,8 +334,7 @@ define float @round_trunc(float %x) {
define float @round_ceil(float %x) {
; CHECK-LABEL: @round_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -365,8 +344,7 @@ define float @round_ceil(float %x) {
define float @round_roundeven(float %x) {
; CHECK-LABEL: @round_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -376,8 +354,7 @@ define float @round_roundeven(float %x) {
define float @round_nearbyint(float %x) {
; CHECK-LABEL: @round_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
@@ -387,8 +364,7 @@ define float @round_nearbyint(float %x) {
define float @round_rint(float %x) {
; CHECK-LABEL: @round_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.round.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.round.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -398,8 +374,7 @@ define float @round_rint(float %x) {
define float @roundeven_floor(float %x) {
; CHECK-LABEL: @roundeven_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -409,8 +384,7 @@ define float @roundeven_floor(float %x) {
define float @roundeven_trunc(float %x) {
; CHECK-LABEL: @roundeven_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -420,8 +394,7 @@ define float @roundeven_trunc(float %x) {
define float @roundeven_ceil(float %x) {
; CHECK-LABEL: @roundeven_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -431,8 +404,7 @@ define float @roundeven_ceil(float %x) {
define float @roundeven_round(float %x) {
; CHECK-LABEL: @roundeven_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -442,8 +414,7 @@ define float @roundeven_round(float %x) {
define float @roundeven_nearbyint(float %x) {
; CHECK-LABEL: @roundeven_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
@@ -453,8 +424,7 @@ define float @roundeven_nearbyint(float %x) {
define float @roundeven_rint(float %x) {
; CHECK-LABEL: @roundeven_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.roundeven.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.roundeven.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -464,8 +434,7 @@ define float @roundeven_rint(float %x) {
define float @nearbyint_floor(float %x) {
; CHECK-LABEL: @nearbyint_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -475,8 +444,7 @@ define float @nearbyint_floor(float %x) {
define float @nearbyint_trunc(float %x) {
; CHECK-LABEL: @nearbyint_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -486,8 +454,7 @@ define float @nearbyint_trunc(float %x) {
define float @nearbyint_ceil(float %x) {
; CHECK-LABEL: @nearbyint_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -497,8 +464,7 @@ define float @nearbyint_ceil(float %x) {
define float @nearbyint_round(float %x) {
; CHECK-LABEL: @nearbyint_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -508,8 +474,7 @@ define float @nearbyint_round(float %x) {
define float @nearbyint_roundeven(float %x) {
; CHECK-LABEL: @nearbyint_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -519,8 +484,7 @@ define float @nearbyint_roundeven(float %x) {
define float @nearbyint_rint(float %x) {
; CHECK-LABEL: @nearbyint_rint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.nearbyint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.rint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.nearbyint.f32(float %x)
%r = call float @llvm.rint.f32(float %a)
@@ -530,8 +494,7 @@ define float @nearbyint_rint(float %x) {
define float @rint_floor(float %x) {
; CHECK-LABEL: @rint_floor(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.floor.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.floor.f32(float %a)
@@ -541,8 +504,7 @@ define float @rint_floor(float %x) {
define float @rint_trunc(float %x) {
; CHECK-LABEL: @rint_trunc(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.trunc.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.trunc.f32(float %a)
@@ -552,8 +514,7 @@ define float @rint_trunc(float %x) {
define float @rint_ceil(float %x) {
; CHECK-LABEL: @rint_ceil(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.ceil.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.ceil.f32(float %a)
@@ -563,8 +524,7 @@ define float @rint_ceil(float %x) {
define float @rint_round(float %x) {
; CHECK-LABEL: @rint_round(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.round.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.round.f32(float %a)
@@ -574,8 +534,7 @@ define float @rint_round(float %x) {
define float @rint_roundeven(float %x) {
; CHECK-LABEL: @rint_roundeven(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.roundeven.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.roundeven.f32(float %a)
@@ -585,8 +544,7 @@ define float @rint_roundeven(float %x) {
define float @rint_nearbyint(float %x) {
; CHECK-LABEL: @rint_nearbyint(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.rint.f32(float [[X:%.*]])
-; CHECK-NEXT: [[R:%.*]] = call float @llvm.nearbyint.f32(float [[A]])
-; CHECK-NEXT: ret float [[R]]
+; CHECK-NEXT: ret float [[A]]
;
%a = call float @llvm.rint.f32(float %x)
%r = call float @llvm.nearbyint.f32(float %a)
More information about the llvm-commits
mailing list