diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp index 4f2edde916b6c..41f33c31f8397 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 5f13beacb6bbb..4050da245c88d 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> ) -; CHECK-NEXT: [[MAX:%.*]] = call <4 x i64> @llvm.smax.v4i64(<4 x i64> [[MIN]], <4 x i64> ) -; 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> )