Skip to content

Commit 995ba4a

Browse files
committed
[CostModel][X86] Adjust ABS scalar SizeLatency cost to 3uops
This was previously set to 4uops which was including the cost of extra register moves in the original test code.
1 parent ec81c9b commit 995ba4a

File tree

3 files changed

+98
-110
lines changed

3 files changed

+98
-110
lines changed

llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,7 +4061,7 @@ X86TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
40614061
{ ISD::CTPOP, MVT::i8, { 1, 1, 2, 2 } }, // popcnt(zext())
40624062
};
40634063
static const CostKindTblEntry X64CostTbl[] = { // 64-bit targets
4064-
{ ISD::ABS, MVT::i64, { 1, 2, 3, 4 } }, // SUB+CMOV
4064+
{ ISD::ABS, MVT::i64, { 1, 2, 3, 3 } }, // SUB+CMOV
40654065
{ ISD::BITREVERSE, MVT::i64, { 10, 12, 20, 22 } },
40664066
{ ISD::BSWAP, MVT::i64, { 1, 2, 1, 2 } },
40674067
{ ISD::CTLZ, MVT::i64, { 4 } }, // BSR+XOR or BSR+XOR+CMOV
@@ -4082,9 +4082,9 @@ X86TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
40824082
{ ISD::UMULO, MVT::i64, { 2 } }, // mulq + seto
40834083
};
40844084
static const CostKindTblEntry X86CostTbl[] = { // 32 or 64-bit targets
4085-
{ ISD::ABS, MVT::i32, { 1, 2, 3, 4 } }, // SUB+XOR+SRA or SUB+CMOV
4086-
{ ISD::ABS, MVT::i16, { 2, 2, 3, 4 } }, // SUB+XOR+SRA or SUB+CMOV
4087-
{ ISD::ABS, MVT::i8, { 2, 4, 4, 4 } }, // SUB+XOR+SRA
4085+
{ ISD::ABS, MVT::i32, { 1, 2, 3, 3 } }, // SUB+XOR+SRA or SUB+CMOV
4086+
{ ISD::ABS, MVT::i16, { 2, 2, 3, 3 } }, // SUB+XOR+SRA or SUB+CMOV
4087+
{ ISD::ABS, MVT::i8, { 2, 4, 4, 3 } }, // SUB+XOR+SRA
40884088
{ ISD::BITREVERSE, MVT::i32, { 9, 12, 17, 19 } },
40894089
{ ISD::BITREVERSE, MVT::i16, { 9, 12, 17, 19 } },
40904090
{ ISD::BITREVERSE, MVT::i8, { 7, 9, 13, 14 } },

0 commit comments

Comments
 (0)