Skip to content

Commit 4147b72

Browse files
authored
[CostModel][X86] Fix fpext conversion cost for 16 elements (#76278)
The fpext conversion cost for 16 elements should be 4 from Znver4.
1 parent eee71ed commit 4147b72

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ InstructionCost X86TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
22322232
static const TypeConversionCostTblEntry AVX512FConversionTbl[] = {
22332233
{ ISD::FP_EXTEND, MVT::v8f64, MVT::v8f32, 1 },
22342234
{ ISD::FP_EXTEND, MVT::v8f64, MVT::v16f32, 3 },
2235+
{ ISD::FP_EXTEND, MVT::v16f64, MVT::v16f32, 4 }, // 2*vcvtps2pd+vextractf64x4
22352236
{ ISD::FP_ROUND, MVT::v8f32, MVT::v8f64, 1 },
22362237

22372238
{ ISD::TRUNCATE, MVT::v2i1, MVT::v2i8, 3 }, // sext+vpslld+vptestmd

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ define void @fp_conv(<8 x float> %a, <16 x float>%b, <4 x float> %c) {
632632
; AVX512-LABEL: 'fp_conv'
633633
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A1 = fpext <4 x float> %c to <4 x double>
634634
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A2 = fpext <8 x float> %a to <8 x double>
635-
; AVX512-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %A3 = fpext <16 x float> %b to <16 x double>
635+
; AVX512-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %A3 = fpext <16 x float> %b to <16 x double>
636636
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A4 = fptrunc <4 x double> undef to <4 x float>
637637
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %A5 = fptrunc <8 x double> undef to <8 x float>
638638
; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void

0 commit comments

Comments
 (0)