[llvm] aa97f6b - [AIC] Fix the sext cost operands in tryToFPToSat
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 7 01:33:24 PDT 2023
Author: David Green
Date: 2023-08-07T09:33:18+01:00
New Revision: aa97f6b4947e599e17e900aebd511d8d497c3be9
URL: https://github.com/llvm/llvm-project/commit/aa97f6b4947e599e17e900aebd511d8d497c3be9
DIFF: https://github.com/llvm/llvm-project/commit/aa97f6b4947e599e17e900aebd511d8d497c3be9.diff
LOG: [AIC] Fix the sext cost operands in tryToFPToSat
As pointed out in D125755 the operand of a call to getCastInstrCost had the Src
and Dst the wrong way around.
Differential Revision: https://reviews.llvm.org/D154841
Added:
Modified:
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
index 4f2edde916b6c8..41f33c31f83977 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -373,7 +373,7 @@ static bool tryToFPToSat(Instruction &I, TargetTransformInfo &TTI) {
InstructionCost SatCost = TTI.getIntrinsicInstrCost(
IntrinsicCostAttributes(Intrinsic::fptosi_sat, SatTy, {In}, {FpTy}),
TTI::TCK_RecipThroughput);
- SatCost += TTI.getCastInstrCost(Instruction::SExt, SatTy, IntTy,
+ SatCost += TTI.getCastInstrCost(Instruction::SExt, IntTy, SatTy,
TTI::CastContextHint::None,
TTI::TCK_RecipThroughput);
diff --git a/llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll b/llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll
index 5f13beacb6bbbf..4050da245c88df 100644
--- a/llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll
+++ b/llvm/test/Transforms/AggressiveInstCombine/X86/fptosisat.ll
@@ -146,10 +146,9 @@ define i32 @f16_i8(half %in) {
define <4 x i64> @v4f32_i32(<4 x float> %in) {
; CHECK-LABEL: @v4f32_i32(
-; CHECK-NEXT: [[CONV:%.*]] = fptosi <4 x float> [[IN:%.*]] to <4 x i64>
-; CHECK-NEXT: [[MIN:%.*]] = call <4 x i64> @llvm.smin.v4i64(<4 x i64> [[CONV]], <4 x i64> <i64 2147483647, i64 2147483647, i64 2147483647, i64 2147483647>)
-; CHECK-NEXT: [[MAX:%.*]] = call <4 x i64> @llvm.smax.v4i64(<4 x i64> [[MIN]], <4 x i64> <i64 -2147483648, i64 -2147483648, i64 -2147483648, i64 -2147483648>)
-; CHECK-NEXT: ret <4 x i64> [[MAX]]
+; CHECK-NEXT: [[TMP1:%.*]] = call <4 x i32> @llvm.fptosi.sat.v4i32.v4f32(<4 x float> [[IN:%.*]])
+; CHECK-NEXT: [[TMP2:%.*]] = sext <4 x i32> [[TMP1]] to <4 x i64>
+; CHECK-NEXT: ret <4 x i64> [[TMP2]]
;
%conv = fptosi <4 x float> %in to <4 x i64>
%min = call <4 x i64> @llvm.smin.v4i64(<4 x i64> %conv, <4 x i64> <i64 2147483647, i64 2147483647, i64 2147483647, i64 2147483647>)
More information about the llvm-commits
mailing list