Skip to content

Commit 5d48633

Browse files
committed
AMDGPU: Correct costs of saturating add/sub intrinsics
These are directly legal with fast instructions.
1 parent 6a73464 commit 5d48633

File tree

3 files changed

+339
-337
lines changed

3 files changed

+339
-337
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,9 @@ GCNTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
738738
case Intrinsic::usub_sat:
739739
case Intrinsic::sadd_sat:
740740
case Intrinsic::ssub_sat:
741-
// TODO: Full rate for i32/i16
741+
if (SLT == MVT::i16 || SLT == MVT::i32)
742+
InstRate = getFullRateInstrCost();
743+
742744
static const auto ValidSatTys = {MVT::v2i16, MVT::v4i16};
743745
if (any_of(ValidSatTys, [&LT](MVT M) { return M == LT.second; }))
744746
NElts = 1;

0 commit comments

Comments
 (0)