[PowerPC] Update Vector Costs for P9
[llvm-core.git] / lib / Target / PowerPC / PPCTargetTransformInfo.h
bloba8d9d092854facec5ed3f8543a355a41e3ce7210
1 //===-- PPCTargetTransformInfo.h - PPC specific TTI -------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file a TargetTransformInfo::Concept conforming object specific to the
10 /// PPC target machine. It uses the target's detailed information to
11 /// provide more precise answers to certain TTI queries, while letting the
12 /// target independent and default TTI implementations handle the rest.
13 ///
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_POWERPC_PPCTARGETTRANSFORMINFO_H
19 #include "PPC.h"
20 #include "PPCTargetMachine.h"
21 #include "llvm/Analysis/TargetTransformInfo.h"
22 #include "llvm/CodeGen/BasicTTIImpl.h"
23 #include "llvm/CodeGen/TargetLowering.h"
25 namespace llvm {
27 class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
28 typedef BasicTTIImplBase<PPCTTIImpl> BaseT;
29 typedef TargetTransformInfo TTI;
30 friend BaseT;
32 const PPCSubtarget *ST;
33 const PPCTargetLowering *TLI;
35 const PPCSubtarget *getST() const { return ST; }
36 const PPCTargetLowering *getTLI() const { return TLI; }
38 public:
39 explicit PPCTTIImpl(const PPCTargetMachine *TM, const Function &F)
40 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
41 TLI(ST->getTargetLowering()) {}
43 /// \name Scalar TTI Implementations
44 /// @{
46 using BaseT::getIntImmCost;
47 int getIntImmCost(const APInt &Imm, Type *Ty);
49 int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
50 int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
51 Type *Ty);
53 unsigned getUserCost(const User *U, ArrayRef<const Value *> Operands);
55 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
56 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
57 TTI::UnrollingPreferences &UP);
59 /// @}
61 /// \name Vector TTI Implementations
62 /// @{
63 bool useColdCCForColdCall(Function &F);
64 bool enableAggressiveInterleaving(bool LoopHasReductions);
65 const TTI::MemCmpExpansionOptions *enableMemCmpExpansion(
66 bool IsZeroCmp) const;
67 bool enableInterleavedAccessVectorization();
68 unsigned getNumberOfRegisters(bool Vector);
69 unsigned getRegisterBitWidth(bool Vector) const;
70 unsigned getCacheLineSize();
71 unsigned getPrefetchDistance();
72 unsigned getMaxInterleaveFactor(unsigned VF);
73 int vectorCostAdjustment(int Cost, unsigned Opcode, Type *Ty1, Type *Ty2);
74 int getArithmeticInstrCost(
75 unsigned Opcode, Type *Ty,
76 TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
77 TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
78 TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
79 TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
80 ArrayRef<const Value *> Args = ArrayRef<const Value *>());
81 int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
82 int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
83 const Instruction *I = nullptr);
84 int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
85 const Instruction *I = nullptr);
86 int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
87 int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
88 unsigned AddressSpace, const Instruction *I = nullptr);
89 int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
90 unsigned Factor,
91 ArrayRef<unsigned> Indices,
92 unsigned Alignment,
93 unsigned AddressSpace,
94 bool UseMaskForCond = false,
95 bool UseMaskForGaps = false);
97 /// @}
100 } // end namespace llvm
102 #endif