23 using namespace TargetOpcode;
25 #ifndef LLVM_BUILD_GLOBAL_ISEL
26 #error "You shouldn't build this"
31 : Subtarget(STI), TM(TM) {
33 setLegalizerInfo32bit();
34 setLegalizerInfo64bit();
35 setLegalizerInfoSSE1();
36 setLegalizerInfoSSE2();
37 setLegalizerInfoSSE41();
38 setLegalizerInfoAVX();
39 setLegalizerInfoAVX2();
40 setLegalizerInfoAVX512();
41 setLegalizerInfoAVX512DQ();
42 setLegalizerInfoAVX512BW();
47 void X86LegalizerInfo::setLegalizerInfo32bit() {
59 for (
unsigned BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
60 for (
auto Ty : {s8, s16, s32})
63 for (
unsigned Op : {G_UADDE}) {
68 for (
unsigned MemOp : {G_LOAD, G_STORE}) {
69 for (
auto Ty : {s8, s16, s32, p0})
84 for (
auto Ty : {s1, s8, s16})
88 for (
auto Ty : {s8, s16, s32, p0})
95 for (
auto Ty : {s8, s16, s32}) {
100 for (
auto Ty : {s1, s8, s16}) {
108 for (
auto Ty : {s8, s16, s32, p0})
112 void X86LegalizerInfo::setLegalizerInfo64bit() {
124 for (
unsigned BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
125 for (
auto Ty : {s8, s16, s32, s64})
128 for (
unsigned MemOp : {G_LOAD, G_STORE}) {
129 for (
auto Ty : {s8, s16, s32, s64, p0})
145 for (
auto Ty : {s1, s8, s16})
149 for (
auto Ty : {s8, s16, s32, s64, p0})
155 for (
auto Ty : {s8, s16, s32, s64}) {
160 for (
auto Ty : {s1, s8, s16, s32}) {
168 for (
auto Ty : {s8, s16, s32, s64, p0})
172 void X86LegalizerInfo::setLegalizerInfoSSE1() {
180 for (
unsigned BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV})
181 for (
auto Ty : {s32, v4s32})
184 for (
unsigned MemOp : {G_LOAD, G_STORE})
185 for (
auto Ty : {v4s32, v2s64})
189 void X86LegalizerInfo::setLegalizerInfoSSE2() {
199 for (
unsigned BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV})
200 for (
auto Ty : {s64, v2s64})
203 for (
unsigned BinOp : {G_ADD, G_SUB})
204 for (
auto Ty : {v16s8, v8s16, v4s32, v2s64})
210 void X86LegalizerInfo::setLegalizerInfoSSE41() {
219 void X86LegalizerInfo::setLegalizerInfoAVX() {
233 for (
unsigned MemOp : {G_LOAD, G_STORE})
234 for (
auto Ty : {v8s32, v4s64})
237 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64}) {
241 for (
auto Ty : {v16s8, v8s16, v4s32, v2s64}) {
247 void X86LegalizerInfo::setLegalizerInfoAVX2() {
256 for (
unsigned BinOp : {G_ADD, G_SUB})
257 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64})
260 for (
auto Ty : {v16s16, v8s32})
264 void X86LegalizerInfo::setLegalizerInfoAVX512() {
283 for (
unsigned BinOp : {G_ADD, G_SUB})
284 for (
auto Ty : {v16s32, v8s64})
289 for (
unsigned MemOp : {G_LOAD, G_STORE})
290 for (
auto Ty : {v16s32, v8s64})
293 for (
auto Ty : {v64s8, v32s16, v16s32, v8s64}) {
297 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64, v16s8, v8s16, v4s32, v2s64}) {
306 for (
auto Ty : {v4s32, v8s32})
310 void X86LegalizerInfo::setLegalizerInfoAVX512DQ() {
325 for (
auto Ty : {v2s64, v4s64})
329 void X86LegalizerInfo::setLegalizerInfoAVX512BW() {
336 for (
unsigned BinOp : {G_ADD, G_SUB})
337 for (
auto Ty : {v64s8, v32s16})
349 for (
auto Ty : {v8s16, v16s16})
X86LegalizerInfo(const X86Subtarget &STI, const X86TargetMachine &TM)
void computeTables()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
The operation should be synthesized from multiple instructions acting on a narrower scalar base-type...
The operation should be implemented in terms of a wider scalar base-type.
The operation is expected to be selectable directly by the target, and no transformation is necessary...
unsigned getPointerSize() const
Get the pointer size for this target.
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
This file declares the targeting of the Machinelegalizer class for X86.
static LLT vector(uint16_t NumElements, unsigned ScalarSizeInBits)
Get a low-level vector of some number of elements and element width.
void setAction(const InstrAspect &Aspect, LegalizeAction Action)
More friendly way to set an action for common types that have an LLT representation.