LLVM: lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18using namespace llvm;
19
20#define DEBUG_TYPE "loongarchtti"
21
25 switch (K) {
29 if (ST->hasExtLASX())
31 if (ST->hasExtLSX())
33 [[fallthrough]];
35 return DefSize;
36 }
37
39}
40
42 switch (ClassID) {
43 case LoongArchRegisterClass::GPRRC:
44
45 return 30;
46 case LoongArchRegisterClass::FPRRC:
47 return ST->hasBasicF() ? 32 : 0;
48 case LoongArchRegisterClass::VRRC:
49 return ST->hasExtLSX() ? 32 : 0;
50 }
52}
53
55 Type *Ty) const {
57 return LoongArchRegisterClass::VRRC;
58 if (!Ty)
59 return LoongArchRegisterClass::GPRRC;
60
62 if ((ScalarTy->isFloatTy() && ST->hasBasicF()) ||
63 (ScalarTy->isDoubleTy() && ST->hasBasicD())) {
64 return LoongArchRegisterClass::FPRRC;
65 }
66
67 return LoongArchRegisterClass::GPRRC;
68}
69
71 return ST->getMaxInterleaveFactor();
72}
73
75 switch (ClassID) {
76 case LoongArchRegisterClass::GPRRC:
77 return "LoongArch::GPRRC";
78 case LoongArchRegisterClass::FPRRC:
79 return "LoongArch::FPRRC";
80 case LoongArchRegisterClass::VRRC:
81 return "LoongArch::VRRC";
82 }
84}
85
91
93
95
97
99 switch (II->getIntrinsicID()) {
100 default:
101 return true;
102 case Intrinsic::vector_reduce_add:
103 case Intrinsic::vector_reduce_and:
104 case Intrinsic::vector_reduce_or:
105 case Intrinsic::vector_reduce_smax:
106 case Intrinsic::vector_reduce_smin:
107 case Intrinsic::vector_reduce_umax:
108 case Intrinsic::vector_reduce_umin:
109 case Intrinsic::vector_reduce_xor:
110 return false;
111 }
112}
113
117
118 if (!ST->hasUAL())
120
121 Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
123 Options.AllowOverlappingLoads = true;
124
125
126 if (ST->is64Bit()) {
127 Options.LoadSizes = {8, 4, 2, 1};
128 Options.AllowedTailExpansions = {3, 5, 6};
129 } else {
130 Options.LoadSizes = {4, 2, 1};
131 Options.AllowedTailExpansions = {3};
132 }
133
135}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file a TargetTransformInfoImplBase conforming object specific to the LoongArch target machine.
uint64_t IntrinsicInst * II
A wrapper class for inspecting calls to intrinsic functions.
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override
Definition LoongArchTargetTransformInfo.cpp:87
unsigned getCacheLineSize() const override
Definition LoongArchTargetTransformInfo.cpp:92
bool shouldExpandReduction(const IntrinsicInst *II) const override
Definition LoongArchTargetTransformInfo.cpp:98
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const override
Definition LoongArchTargetTransformInfo.cpp:54
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override
Definition LoongArchTargetTransformInfo.cpp:115
unsigned getMaxInterleaveFactor(ElementCount VF) const override
Definition LoongArchTargetTransformInfo.cpp:70
const char * getRegisterClassName(unsigned ClassID) const override
Definition LoongArchTargetTransformInfo.cpp:74
unsigned getNumberOfRegisters(unsigned ClassID) const override
Definition LoongArchTargetTransformInfo.cpp:41
unsigned getPrefetchDistance() const override
Definition LoongArchTargetTransformInfo.cpp:94
bool enableWritePrefetching() const override
Definition LoongArchTargetTransformInfo.cpp:96
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
Definition LoongArchTargetTransformInfo.cpp:22
virtual TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
PopcntSupportKind
Flags indicating the kind of support for population count.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Returns options for expansion of memcmp. IsZeroCmp is.