Skip to content

Commit ed41249

Browse files
committed
[CostModel][X86] Update AVX1 sext v4i1 -> v4i64 cost based off worst case llvm-mca numbers
We were using raw instruction count which overestimated the costs for #67803
1 parent 62740d8 commit ed41249

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,7 @@ InstructionCost X86TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
26642664
};
26652665

26662666
static const TypeConversionCostTblEntry AVXConversionTbl[] = {
2667-
{ ISD::SIGN_EXTEND, MVT::v4i64, MVT::v4i1, 6 },
2667+
{ ISD::SIGN_EXTEND, MVT::v4i64, MVT::v4i1, 4 },
26682668
{ ISD::ZERO_EXTEND, MVT::v4i64, MVT::v4i1, 4 },
26692669
{ ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i1, 4 },
26702670
{ ISD::ZERO_EXTEND, MVT::v8i32, MVT::v8i1, 4 },

llvm/test/Analysis/CostModel/X86/cast.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ define i32 @masks4(<4 x i1> %in) {
374374
;
375375
; AVX1-LABEL: 'masks4'
376376
; AVX1-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
377-
; AVX1-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %S = sext <4 x i1> %in to <4 x i64>
377+
; AVX1-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %S = sext <4 x i1> %in to <4 x i64>
378378
; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
379379
;
380380
; AVX2-LABEL: 'masks4'

llvm/test/Analysis/CostModel/X86/extend.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ define i32 @sext_vXi1() "min-legal-vector-width"="256" {
19621962
; AVX1-LABEL: 'sext_vXi1'
19631963
; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = sext i1 undef to i64
19641964
; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2i64 = sext <2 x i1> undef to <2 x i64>
1965-
; AVX1-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V4i64 = sext <4 x i1> undef to <4 x i64>
1965+
; AVX1-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4i64 = sext <4 x i1> undef to <4 x i64>
19661966
; AVX1-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V8i64 = sext <8 x i1> undef to <8 x i64>
19671967
; AVX1-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V16i64 = sext <16 x i1> undef to <16 x i64>
19681968
; AVX1-NEXT: Cost Model: Found an estimated cost of 25 for instruction: %V32i64 = sext <32 x i1> undef to <32 x i64>
@@ -2242,7 +2242,7 @@ define i32 @sext_vXi1() "min-legal-vector-width"="256" {
22422242
; BTVER2-LABEL: 'sext_vXi1'
22432243
; BTVER2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = sext i1 undef to i64
22442244
; BTVER2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2i64 = sext <2 x i1> undef to <2 x i64>
2245-
; BTVER2-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V4i64 = sext <4 x i1> undef to <4 x i64>
2245+
; BTVER2-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4i64 = sext <4 x i1> undef to <4 x i64>
22462246
; BTVER2-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V8i64 = sext <8 x i1> undef to <8 x i64>
22472247
; BTVER2-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V16i64 = sext <16 x i1> undef to <16 x i64>
22482248
; BTVER2-NEXT: Cost Model: Found an estimated cost of 25 for instruction: %V32i64 = sext <32 x i1> undef to <32 x i64>

0 commit comments

Comments
 (0)