@@ -1557,64 +1557,6 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
15571557 return Cost;
15581558 }
15591559
1560- InstructionCost
1561- getMaskedMemoryOpCost (const MemIntrinsicCostAttributes &MICA,
1562- TTI::TargetCostKind CostKind) const override {
1563- Type *DataTy = MICA.getDataType ();
1564- Align Alignment = MICA.getAlignment ();
1565- unsigned Opcode = MICA.getID () == Intrinsic::masked_load
1566- ? Instruction::Load
1567- : Instruction::Store;
1568- // TODO: Pass on AddressSpace when we have test coverage.
1569- return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment, true , false ,
1570- CostKind);
1571- }
1572-
1573- InstructionCost
1574- getGatherScatterOpCost (const MemIntrinsicCostAttributes &MICA,
1575- TTI::TargetCostKind CostKind) const override {
1576- unsigned Opcode = (MICA.getID () == Intrinsic::masked_gather ||
1577- MICA.getID () == Intrinsic::vp_gather)
1578- ? Instruction::Load
1579- : Instruction::Store;
1580- Type *DataTy = MICA.getDataType ();
1581- bool VariableMask = MICA.getVariableMask ();
1582- Align Alignment = MICA.getAlignment ();
1583- return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment, VariableMask,
1584- true , CostKind);
1585- }
1586-
1587- InstructionCost
1588- getExpandCompressMemoryOpCost (const MemIntrinsicCostAttributes &MICA,
1589- TTI::TargetCostKind CostKind) const override {
1590- unsigned Opcode = MICA.getID () == Intrinsic::masked_expandload
1591- ? Instruction::Load
1592- : Instruction::Store;
1593- Type *DataTy = MICA.getDataType ();
1594- bool VariableMask = MICA.getVariableMask ();
1595- Align Alignment = MICA.getAlignment ();
1596- // Treat expand load/compress store as gather/scatter operation.
1597- // TODO: implement more precise cost estimation for these intrinsics.
1598- return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment, VariableMask,
1599- /* IsGatherScatter*/ true , CostKind);
1600- }
1601-
1602- InstructionCost
1603- getStridedMemoryOpCost (const MemIntrinsicCostAttributes &MICA,
1604- TTI::TargetCostKind CostKind) const override {
1605- // For a target without strided memory operations (or for an illegal
1606- // operation type on one which does), assume we lower to a gather/scatter
1607- // operation. (Which may in turn be scalarized.)
1608- unsigned IID = MICA.getID () == Intrinsic::experimental_vp_strided_load
1609- ? Intrinsic::masked_gather
1610- : Intrinsic::masked_scatter;
1611- return thisT ()->getGatherScatterOpCost (
1612- MemIntrinsicCostAttributes (IID, MICA.getDataType (), MICA.getPointer (),
1613- MICA.getVariableMask (), MICA.getAlignment (),
1614- MICA.getInst ()),
1615- CostKind);
1616- }
1617-
16181560 InstructionCost getInterleavedMemoryOpCost (
16191561 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned > Indices,
16201562 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
@@ -3062,22 +3004,56 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
30623004 getMemIntrinsicInstrCost (const MemIntrinsicCostAttributes &MICA,
30633005 TTI::TargetCostKind CostKind) const override {
30643006 unsigned Id = MICA.getID ();
3007+ Type *DataTy = MICA.getDataType ();
3008+ bool VariableMask = MICA.getVariableMask ();
3009+ Align Alignment = MICA.getAlignment ();
30653010
30663011 switch (Id) {
30673012 case Intrinsic::experimental_vp_strided_load:
3068- case Intrinsic::experimental_vp_strided_store:
3069- return thisT ()->getStridedMemoryOpCost (MICA, CostKind);
3013+ case Intrinsic::experimental_vp_strided_store: {
3014+ unsigned Opcode = Id == Intrinsic::experimental_vp_strided_load
3015+ ? Instruction::Load
3016+ : Instruction::Store;
3017+ // For a target without strided memory operations (or for an illegal
3018+ // operation type on one which does), assume we lower to a gather/scatter
3019+ // operation. (Which may in turn be scalarized.)
3020+ return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment,
3021+ VariableMask, true , CostKind);
3022+ }
30703023 case Intrinsic::masked_scatter:
30713024 case Intrinsic::masked_gather:
30723025 case Intrinsic::vp_scatter:
3073- case Intrinsic::vp_gather:
3074- return thisT ()->getGatherScatterOpCost (MICA, CostKind);
3026+ case Intrinsic::vp_gather: {
3027+ unsigned Opcode = (MICA.getID () == Intrinsic::masked_gather ||
3028+ MICA.getID () == Intrinsic::vp_gather)
3029+ ? Instruction::Load
3030+ : Instruction::Store;
3031+
3032+ return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment,
3033+ VariableMask, true , CostKind);
3034+ }
3035+ case Intrinsic::vp_load:
3036+ case Intrinsic::vp_store:
3037+ return InstructionCost::getInvalid ();
30753038 case Intrinsic::masked_load:
3076- case Intrinsic::masked_store:
3077- return thisT ()->getMaskedMemoryOpCost (MICA, CostKind);
3039+ case Intrinsic::masked_store: {
3040+ unsigned Opcode =
3041+ Id == Intrinsic::masked_load ? Instruction::Load : Instruction::Store;
3042+ // TODO: Pass on AddressSpace when we have test coverage.
3043+ return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment, true , false ,
3044+ CostKind);
3045+ }
30783046 case Intrinsic::masked_compressstore:
3079- case Intrinsic::masked_expandload:
3080- return thisT ()->getExpandCompressMemoryOpCost (MICA, CostKind);
3047+ case Intrinsic::masked_expandload: {
3048+ unsigned Opcode = MICA.getID () == Intrinsic::masked_expandload
3049+ ? Instruction::Load
3050+ : Instruction::Store;
3051+ // Treat expand load/compress store as gather/scatter operation.
3052+ // TODO: implement more precise cost estimation for these intrinsics.
3053+ return getCommonMaskedMemoryOpCost (Opcode, DataTy, Alignment,
3054+ VariableMask,
3055+ /* IsGatherScatter*/ true , CostKind);
3056+ }
30813057 case Intrinsic::vp_load_ff:
30823058 return InstructionCost::getInvalid ();
30833059 default :
0 commit comments