29 using namespace TargetOpcode;
31 auto GetAddrSpacePtr = [&
TM](
unsigned AS) {
50 const LLT AddrSpaces[] = {
58 setAction({G_ADD, S32},
Legal);
59 setAction({G_ASHR, S32},
Legal);
60 setAction({G_SUB, S32},
Legal);
61 setAction({G_MUL, S32},
Legal);
62 setAction({G_AND, S32},
Legal);
63 setAction({G_OR, S32},
Legal);
64 setAction({G_XOR, S32},
Legal);
66 setAction({G_BITCAST, V2S16},
Legal);
67 setAction({G_BITCAST, 1, S32},
Legal);
69 setAction({G_BITCAST, S32},
Legal);
70 setAction({G_BITCAST, 1, V2S16},
Legal);
72 getActionDefinitionsBuilder(G_FCONSTANT)
73 .legalFor({S32, S64});
79 getActionDefinitionsBuilder(G_IMPLICIT_DEF)
81 return Query.
Types[0].getSizeInBits() <= 512;
83 .clampScalar(0, S1, S512);
85 getActionDefinitionsBuilder(G_CONSTANT)
86 .legalFor({S1, S32, S64});
91 setAction({G_CONSTANT, S1},
Legal);
93 setAction({G_FADD, S32},
Legal);
95 setAction({G_FCMP, S1},
Legal);
96 setAction({G_FCMP, 1, S32},
Legal);
97 setAction({G_FCMP, 1, S64},
Legal);
99 setAction({G_FMUL, S32},
Legal);
101 setAction({G_ZEXT, S64},
Legal);
102 setAction({G_ZEXT, 1, S32},
Legal);
104 setAction({G_FPTOSI, S32},
Legal);
105 setAction({G_FPTOSI, 1, S32},
Legal);
107 setAction({G_SITOFP, S32},
Legal);
108 setAction({G_SITOFP, 1, S32},
Legal);
110 setAction({G_FPTOUI, S32},
Legal);
111 setAction({G_FPTOUI, 1, S32},
Legal);
113 for (
LLT PtrTy : AddrSpaces) {
115 setAction({G_GEP, PtrTy},
Legal);
116 setAction({G_GEP, 1, IdxTy},
Legal);
119 setAction({G_ICMP, S1},
Legal);
120 setAction({G_ICMP, 1, S32},
Legal);
123 getActionDefinitionsBuilder({G_LOAD, G_STORE})
149 setAction({G_SELECT, S32},
Legal);
150 setAction({G_SELECT, 1, S1},
Legal);
152 setAction({G_SHL, S32},
Legal);
161 setAction({G_GEP, S64},
Legal);
163 for (
unsigned Op : {G_EXTRACT_VECTOR_ELT, G_INSERT_VECTOR_ELT}) {
164 getActionDefinitionsBuilder(
Op)
175 getActionDefinitionsBuilder({G_EXTRACT, G_INSERT})
184 for (
unsigned Op : {G_MERGE_VALUES, G_UNMERGE_VALUES}) {
185 unsigned BigTyIdx =
Op == G_MERGE_VALUES ? 0 : 1;
186 unsigned LitTyIdx =
Op == G_MERGE_VALUES ? 1 : 0;
188 getActionDefinitionsBuilder(
Op)
190 const LLT &BigTy = Query.
Types[BigTyIdx];
191 const LLT &LitTy = Query.
Types[LitTyIdx];
197 .fewerElementsIf([](
const LegalityQuery &Query) {
return true; },
199 return std::make_pair(
200 0, Query.
Types[0].getElementType());
202 .fewerElementsIf([](
const LegalityQuery &Query) {
return true; },
204 return std::make_pair(
205 1, Query.
Types[1].getElementType());
Compute iterated dominance frontiers using a linear time algorithm.
The LegalityQuery object bundles together all the information that's needed to decide whether a given...
const SIInstrInfo * getInstrInfo() const override
Address space for local memory.
Address space for constant memory (VTX2)
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
unsigned getPointerSizeInBits(unsigned AS) const
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
Generation getGeneration() const
AMDGPULegalizerInfo(const GCNSubtarget &ST, const GCNTargetMachine &TM)
The AMDGPU TargetMachine interface definition for hw codgen targets.
bool verify(const TargetRegisterInfo &TRI) const
Check that information hold by this instance make sense for the given TRI.
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
AMDGPUAS getAMDGPUAS() const
This file declares the targeting of the Machinelegalizer class for AMDGPU.
Address space for global memory (RAT0, VTX0).
unsigned FLAT_ADDRESS
Address space for flat memory.
static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, bool &Write, bool &Effects, bool &StackPointer)
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
static LLT vector(uint16_t NumElements, unsigned ScalarSizeInBits)
Get a low-level vector of some number of elements and element width.
The operation is expected to be selectable directly by the target, and no transformation is necessary...
unsigned PRIVATE_ADDRESS
Address space for private memory.