blob: 28821a2ca111605dc4b56be4d3db12a7264f05b7 [file] [log] [blame]
Ulrich Weigand1f6666a2015-03-31 12:52:27 +00001//===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
11#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
12
13#include "SystemZTargetMachine.h"
14#include "llvm/Analysis/TargetTransformInfo.h"
15#include "llvm/CodeGen/BasicTTIImpl.h"
16
17namespace llvm {
18
19class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
20 typedef BasicTTIImplBase<SystemZTTIImpl> BaseT;
21 typedef TargetTransformInfo TTI;
22 friend BaseT;
23
24 const SystemZSubtarget *ST;
25 const SystemZTargetLowering *TLI;
26
27 const SystemZSubtarget *getST() const { return ST; }
28 const SystemZTargetLowering *getTLI() const { return TLI; }
29
Jonas Paulssonfccc7d62017-04-12 11:49:08 +000030 unsigned const LIBCALL_COST = 30;
31
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000032public:
Eric Christophera4e5d3c2015-09-16 23:38:13 +000033 explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
Mehdi Amini5010ebf2015-07-09 02:08:42 +000034 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
35 TLI(ST->getTargetLowering()) {}
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000036
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000037 /// \name Scalar TTI Implementations
38 /// @{
39
Chandler Carruth93205eb2015-08-05 18:08:10 +000040 int getIntImmCost(const APInt &Imm, Type *Ty);
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000041
Chandler Carruth93205eb2015-08-05 18:08:10 +000042 int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
43 int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
44 Type *Ty);
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000045
Ulrich Weigandb4012182015-03-31 12:56:33 +000046 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
47
Geoff Berry66d9bdb2017-06-28 15:53:17 +000048 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
49 TTI::UnrollingPreferences &UP);
Jonas Paulsson58c5a7f2016-09-28 09:41:38 +000050
Jonas Paulsson024e3192017-07-21 11:59:37 +000051 bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
52 TargetTransformInfo::LSRCost &C2);
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000053 /// @}
Ulrich Weigandce4c1092015-05-05 19:25:42 +000054
55 /// \name Vector TTI Implementations
56 /// @{
57
58 unsigned getNumberOfRegisters(bool Vector);
Daniel Neilsonc0112ae2017-06-12 14:22:21 +000059 unsigned getRegisterBitWidth(bool Vector) const;
Ulrich Weigandce4c1092015-05-05 19:25:42 +000060
Jonas Paulsson89ca10d2017-07-14 13:52:38 +000061 unsigned getCacheLineSize() { return 256; }
62 unsigned getPrefetchDistance() { return 2000; }
63 unsigned getMinPrefetchStride() { return 2048; }
64
Jonas Paulsson8624b7e2017-05-24 13:42:56 +000065 bool prefersVectorizedAddressing() { return false; }
Jonas Paulsson024e3192017-07-21 11:59:37 +000066 bool LSRWithInstrQueries() { return true; }
Jonas Paulssonda74ed42017-04-12 12:41:37 +000067 bool supportsEfficientVectorElementLoadStore() { return true; }
Jonas Paulssonfccc7d62017-04-12 11:49:08 +000068 bool enableInterleavedAccessVectorization() { return true; }
69
70 int getArithmeticInstrCost(
71 unsigned Opcode, Type *Ty,
72 TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
73 TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
74 TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
75 TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
76 ArrayRef<const Value *> Args = ArrayRef<const Value *>());
77 int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
78 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
79 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
80 int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
81 const Instruction *I = nullptr);
82 int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
83 const Instruction *I = nullptr);
84 int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
85 int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
86 unsigned AddressSpace, const Instruction *I = nullptr);
87
88 int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
89 unsigned Factor,
90 ArrayRef<unsigned> Indices,
91 unsigned Alignment,
92 unsigned AddressSpace);
Ulrich Weigandce4c1092015-05-05 19:25:42 +000093 /// @}
Ulrich Weigand1f6666a2015-03-31 12:52:27 +000094};
95
96} // end namespace llvm
97
98#endif