diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-12-06 13:29:31 -0500 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-12-06 13:50:25 -0500 |
| commit | 7ff0fcb53f6e71bc22d37494fdfa68bbf2d3709b (patch) | |
| tree | 84beb1dfd24fc05bc11a0bdc612e3ac6c7cf09b5 /llvm/lib | |
| parent | 9a0b5e14075a1f42a72eedb66fd4fde7985d37ac (diff) | |
| download | bcm5719-llvm-7ff0fcb53f6e71bc22d37494fdfa68bbf2d3709b.tar.gz bcm5719-llvm-7ff0fcb53f6e71bc22d37494fdfa68bbf2d3709b.zip | |
[x86] add cost model special-case for insert/extract from element 0
This is a follow-up to D70607 where we made any
extract element on SLM more costly than default. But that is
pessimistic for extract from element 0 because that corresponds
to x86 movd/movq instructions. These generally have >1 cycle
latency, but they are probably implemented as single uop
instructions.
Note that no vectorization tests are affected by this change.
Also, no targets besides SLM are affected because those are
falling through to the default cost of 1 anyway. But this will
become visible/important if we add more specializations via cost
tables.
Differential Revision: https://reviews.llvm.org/D71023
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index 831b6a76ed1..9f71d626dda 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -2400,9 +2400,15 @@ int X86TTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index) { unsigned Width = LT.second.getVectorNumElements(); Index = Index % Width; - // Floating point scalars are already located in index #0. - if (ScalarType->isFloatingPointTy() && Index == 0) - return 0; + if (Index == 0) { + // Floating point scalars are already located in index #0. + if (ScalarType->isFloatingPointTy()) + return 0; + + // Assume movd/movq XMM <-> GPR is relatively cheap on all targets. + if (ScalarType->isIntegerTy()) + return 1; + } int ISD = TLI->InstructionOpcodeToISD(Opcode); assert(ISD && "Unexpected vector opcode"); |

