1 //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
12 #include "SystemZTargetMachine.h"
13 #include "llvm/Analysis/TargetTransformInfo.h"
14 #include "llvm/CodeGen/BasicTTIImpl.h"
18 class SystemZTTIImpl
: public BasicTTIImplBase
<SystemZTTIImpl
> {
19 typedef BasicTTIImplBase
<SystemZTTIImpl
> BaseT
;
20 typedef TargetTransformInfo TTI
;
23 const SystemZSubtarget
*ST
;
24 const SystemZTargetLowering
*TLI
;
26 const SystemZSubtarget
*getST() const { return ST
; }
27 const SystemZTargetLowering
*getTLI() const { return TLI
; }
29 unsigned const LIBCALL_COST
= 30;
32 explicit SystemZTTIImpl(const SystemZTargetMachine
*TM
, const Function
&F
)
33 : BaseT(TM
, F
.getParent()->getDataLayout()), ST(TM
->getSubtargetImpl(F
)),
34 TLI(ST
->getTargetLowering()) {}
36 /// \name Scalar TTI Implementations
39 unsigned getInliningThresholdMultiplier() { return 3; }
41 int getIntImmCost(const APInt
&Imm
, Type
*Ty
);
43 int getIntImmCost(unsigned Opcode
, unsigned Idx
, const APInt
&Imm
, Type
*Ty
);
44 int getIntImmCost(Intrinsic::ID IID
, unsigned Idx
, const APInt
&Imm
,
47 TTI::PopcntSupportKind
getPopcntSupport(unsigned TyWidth
);
49 void getUnrollingPreferences(Loop
*L
, ScalarEvolution
&SE
,
50 TTI::UnrollingPreferences
&UP
);
52 bool isLSRCostLess(TargetTransformInfo::LSRCost
&C1
,
53 TargetTransformInfo::LSRCost
&C2
);
56 /// \name Vector TTI Implementations
59 unsigned getNumberOfRegisters(bool Vector
);
60 unsigned getRegisterBitWidth(bool Vector
) const;
62 unsigned getCacheLineSize() { return 256; }
63 unsigned getPrefetchDistance() { return 2000; }
64 unsigned getMinPrefetchStride() { return 2048; }
66 bool hasDivRemOp(Type
*DataType
, bool IsSigned
);
67 bool prefersVectorizedAddressing() { return false; }
68 bool LSRWithInstrQueries() { return true; }
69 bool supportsEfficientVectorElementLoadStore() { return true; }
70 bool enableInterleavedAccessVectorization() { return true; }
72 int getArithmeticInstrCost(
73 unsigned Opcode
, Type
*Ty
,
74 TTI::OperandValueKind Opd1Info
= TTI::OK_AnyValue
,
75 TTI::OperandValueKind Opd2Info
= TTI::OK_AnyValue
,
76 TTI::OperandValueProperties Opd1PropInfo
= TTI::OP_None
,
77 TTI::OperandValueProperties Opd2PropInfo
= TTI::OP_None
,
78 ArrayRef
<const Value
*> Args
= ArrayRef
<const Value
*>());
79 int getShuffleCost(TTI::ShuffleKind Kind
, Type
*Tp
, int Index
, Type
*SubTp
);
80 unsigned getVectorTruncCost(Type
*SrcTy
, Type
*DstTy
);
81 unsigned getVectorBitmaskConversionCost(Type
*SrcTy
, Type
*DstTy
);
82 unsigned getBoolVecToIntConversionCost(unsigned Opcode
, Type
*Dst
,
83 const Instruction
*I
);
84 int getCastInstrCost(unsigned Opcode
, Type
*Dst
, Type
*Src
,
85 const Instruction
*I
= nullptr);
86 int getCmpSelInstrCost(unsigned Opcode
, Type
*ValTy
, Type
*CondTy
,
87 const Instruction
*I
= nullptr);
88 int getVectorInstrCost(unsigned Opcode
, Type
*Val
, unsigned Index
);
89 bool isFoldableLoad(const LoadInst
*Ld
, const Instruction
*&FoldedValue
);
90 int getMemoryOpCost(unsigned Opcode
, Type
*Src
, unsigned Alignment
,
91 unsigned AddressSpace
, const Instruction
*I
= nullptr);
93 int getInterleavedMemoryOpCost(unsigned Opcode
, Type
*VecTy
,
95 ArrayRef
<unsigned> Indices
,
97 unsigned AddressSpace
,
98 bool UseMaskForCond
= false,
99 bool UseMaskForGaps
= false);
101 int getIntrinsicInstrCost(Intrinsic::ID ID
, Type
*RetTy
,
102 ArrayRef
<Value
*> Args
, FastMathFlags FMF
,
104 int getIntrinsicInstrCost(Intrinsic::ID ID
, Type
*RetTy
,
105 ArrayRef
<Type
*> Tys
, FastMathFlags FMF
,
106 unsigned ScalarizationCostPassed
= UINT_MAX
);
110 } // end namespace llvm