-
Notifications
You must be signed in to change notification settings - Fork 14.2k
TTI: Check legalization cost of mulfix ISD nodes #100520
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-llvm-analysis @llvm/pr-subscribers-llvm-transforms Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/100520.diff 1 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 314390aee5085..1a089a3fa9634 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -2155,30 +2155,11 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
ISD = ISD::USUBSAT;
break;
case Intrinsic::smul_fix:
- case Intrinsic::umul_fix: {
- unsigned ExtSize = RetTy->getScalarSizeInBits() * 2;
- Type *ExtTy = RetTy->getWithNewBitWidth(ExtSize);
-
- unsigned ExtOp =
- IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
- TTI::CastContextHint CCH = TTI::CastContextHint::None;
-
- InstructionCost Cost = 0;
- Cost += 2 * thisT()->getCastInstrCost(ExtOp, ExtTy, RetTy, CCH, CostKind);
- Cost +=
- thisT()->getArithmeticInstrCost(Instruction::Mul, ExtTy, CostKind);
- Cost += 2 * thisT()->getCastInstrCost(Instruction::Trunc, RetTy, ExtTy,
- CCH, CostKind);
- Cost += thisT()->getArithmeticInstrCost(Instruction::LShr, RetTy,
- CostKind,
- {TTI::OK_AnyValue, TTI::OP_None},
- {TTI::OK_UniformConstantValue, TTI::OP_None});
- Cost += thisT()->getArithmeticInstrCost(Instruction::Shl, RetTy, CostKind,
- {TTI::OK_AnyValue, TTI::OP_None},
- {TTI::OK_UniformConstantValue, TTI::OP_None});
- Cost += thisT()->getArithmeticInstrCost(Instruction::Or, RetTy, CostKind);
- return Cost;
- }
+ ISD = ISD::SMULFIX;
+ break;
+ case Intrinsic::umul_fix:
+ ISD = ISD::UMULFIX;
+ break;
case Intrinsic::sadd_with_overflow:
ISD = ISD::SADDO;
break;
@@ -2413,6 +2394,30 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
CmpInst::BAD_ICMP_PREDICATE, CostKind);
return Cost;
}
+ case Intrinsic::smul_fix:
+ case Intrinsic::umul_fix: {
+ unsigned ExtSize = RetTy->getScalarSizeInBits() * 2;
+ Type *ExtTy = RetTy->getWithNewBitWidth(ExtSize);
+
+ unsigned ExtOp =
+ IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
+ TTI::CastContextHint CCH = TTI::CastContextHint::None;
+
+ InstructionCost Cost = 0;
+ Cost += 2 * thisT()->getCastInstrCost(ExtOp, ExtTy, RetTy, CCH, CostKind);
+ Cost +=
+ thisT()->getArithmeticInstrCost(Instruction::Mul, ExtTy, CostKind);
+ Cost += 2 * thisT()->getCastInstrCost(Instruction::Trunc, RetTy, ExtTy,
+ CCH, CostKind);
+ Cost += thisT()->getArithmeticInstrCost(
+ Instruction::LShr, RetTy, CostKind, {TTI::OK_AnyValue, TTI::OP_None},
+ {TTI::OK_UniformConstantValue, TTI::OP_None});
+ Cost += thisT()->getArithmeticInstrCost(
+ Instruction::Shl, RetTy, CostKind, {TTI::OK_AnyValue, TTI::OP_None},
+ {TTI::OK_UniformConstantValue, TTI::OP_None});
+ Cost += thisT()->getArithmeticInstrCost(Instruction::Or, RetTy, CostKind);
+ return Cost;
+ }
default:
break;
}
|
c98dcbf
to
5a2e8ac
Compare
689ea87
to
39ca2c4
Compare
5a2e8ac
to
3d683da
Compare
39ca2c4
to
1d17da3
Compare
3d683da
to
f154bdb
Compare
1d17da3
to
c382d2f
Compare
f154bdb
to
411c9c8
Compare
c382d2f
to
fc18583
Compare
411c9c8
to
1b09d41
Compare
fc18583
to
ac75fa0
Compare
1b09d41
to
f8959a5
Compare
ac75fa0
to
73397a6
Compare
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.
LGTM - although I don't think we have any legal/custom cost test coverage (only x86 which exapands)
f8959a5
to
fd7e316
Compare
73397a6
to
05c9703
Compare
fd7e316
to
b6e75f2
Compare
05c9703
to
2015249
Compare
294e59f
to
92f7c1e
Compare
2015249
to
b58458d
Compare
No description provided.