23 using namespace TargetOpcode;
38 for (
unsigned i = 0; i < v.size(); ++i) {
39 result.push_back(v[i]);
40 if (i + 1 < v[i].
first && i + 1 < v.size() &&
41 v[i + 1].first != v[i].first + 1)
42 result.push_back({v[i].first + 1, Unsupported});
53 auto Largest = result.back().first;
60 : Subtarget(STI), TM(TM) {
62 setLegalizerInfo32bit();
63 setLegalizerInfo64bit();
64 setLegalizerInfoSSE1();
65 setLegalizerInfoSSE2();
66 setLegalizerInfoSSE41();
67 setLegalizerInfoAVX();
68 setLegalizerInfoAVX2();
69 setLegalizerInfoAVX512();
70 setLegalizerInfoAVX512DQ();
71 setLegalizerInfoAVX512BW();
74 for (
unsigned BinOp : {G_SUB, G_MUL, G_AND, G_OR, G_XOR})
76 for (
unsigned MemOp : {G_LOAD, G_STORE})
88 void X86LegalizerInfo::setLegalizerInfo32bit() {
98 for (
auto Ty : {p0, s1, s8, s16, s32})
101 for (
auto Ty : {s8, s16, s32, p0})
104 for (
unsigned BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
105 for (
auto Ty : {s8, s16, s32})
108 for (
unsigned Op : {G_UADDE}) {
113 for (
unsigned MemOp : {G_LOAD, G_STORE}) {
114 for (
auto Ty : {s8, s16, s32, p0})
137 .legalFor({s8, s16, s32})
138 .clampScalar(0, s8, s32);
145 for (
auto Ty : {s8, s16, s32, p0})
149 for (
auto Ty : {s8, s16, s32}) {
159 for (
auto Ty : {s8, s16, s32, p0})
163 for (
const auto &Ty : {s16, s32, s64}) {
167 for (
const auto &Ty : {s8, s16, s32}) {
173 void X86LegalizerInfo::setLegalizerInfo64bit() {
193 for (
unsigned BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
196 for (
unsigned MemOp : {G_LOAD, G_STORE})
211 for (
unsigned extOp : {G_ZEXT, G_SEXT, G_ANYEXT}) {
217 .clampScalar(1, s32, s64)
227 .legalFor({s8, s16, s32, s64})
228 .clampScalar(0, s8, s64);
237 void X86LegalizerInfo::setLegalizerInfoSSE1() {
246 for (
unsigned BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV})
247 for (
auto Ty : {s32, v4s32})
250 for (
unsigned MemOp : {G_LOAD, G_STORE})
251 for (
auto Ty : {v4s32, v2s64})
258 for (
const auto &Ty : {v4s32, v2s64}) {
266 void X86LegalizerInfo::setLegalizerInfoSSE2() {
282 for (
unsigned BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV})
283 for (
auto Ty : {s64, v2s64})
286 for (
unsigned BinOp : {G_ADD, G_SUB})
287 for (
auto Ty : {v16s8, v8s16, v4s32, v2s64})
299 for (
const auto &Ty :
300 {v16s8, v32s8, v8s16, v16s16, v4s32, v8s32, v2s64, v4s64}) {
304 for (
const auto &Ty : {v16s8, v8s16, v4s32, v2s64}) {
310 void X86LegalizerInfo::setLegalizerInfoSSE41() {
319 void X86LegalizerInfo::setLegalizerInfoAVX() {
337 for (
unsigned MemOp : {G_LOAD, G_STORE})
338 for (
auto Ty : {v8s32, v4s64})
341 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64}) {
345 for (
auto Ty : {v16s8, v8s16, v4s32, v2s64}) {
350 for (
const auto &Ty :
351 {v32s8, v64s8, v16s16, v32s16, v8s32, v16s32, v4s64, v8s64}) {
355 for (
const auto &Ty :
356 {v16s8, v32s8, v8s16, v16s16, v4s32, v8s32, v2s64, v4s64}) {
362 void X86LegalizerInfo::setLegalizerInfoAVX2() {
376 for (
unsigned BinOp : {G_ADD, G_SUB})
377 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64})
380 for (
auto Ty : {v16s16, v8s32})
384 for (
const auto &Ty : {v64s8, v32s16, v16s32, v8s64}) {
388 for (
const auto &Ty : {v32s8, v16s16, v8s32, v4s64}) {
394 void X86LegalizerInfo::setLegalizerInfoAVX512() {
413 for (
unsigned BinOp : {G_ADD, G_SUB})
414 for (
auto Ty : {v16s32, v8s64})
419 for (
unsigned MemOp : {G_LOAD, G_STORE})
420 for (
auto Ty : {v16s32, v8s64})
423 for (
auto Ty : {v64s8, v32s16, v16s32, v8s64}) {
427 for (
auto Ty : {v32s8, v16s16, v8s32, v4s64, v16s8, v8s16, v4s32, v2s64}) {
436 for (
auto Ty : {v4s32, v8s32})
440 void X86LegalizerInfo::setLegalizerInfoAVX512DQ() {
455 for (
auto Ty : {v2s64, v4s64})
459 void X86LegalizerInfo::setLegalizerInfoAVX512BW() {
466 for (
unsigned BinOp : {G_ADD, G_SUB})
467 for (
auto Ty : {v64s8, v32s16})
479 for (
auto Ty : {v8s16, v16s16})
static void addAndInterleaveWithUnsupported(LegalizerInfo::SizeAndActionsVec &result, const LegalizerInfo::SizeAndActionsVec &v)
FIXME: The following static functions are SizeChangeStrategy functions that are meant to temporarily ...
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
Compute iterated dominance frontiers using a linear time algorithm.
The operation should be implemented in terms of a wider scalar base-type.
const X86InstrInfo * getInstrInfo() const override
X86LegalizerInfo(const X86Subtarget &STI, const X86TargetMachine &TM)
std::vector< SizeAndAction > SizeAndActionsVec
static LegalizerInfo::SizeAndActionsVec widen_1(const LegalizerInfo::SizeAndActionsVec &v)
LegalizeRuleSet & legalForCartesianProduct(std::initializer_list< LLT > Types)
The instruction is legal when type indexes 0 and 1 are both in the given list.
static SizeAndActionsVec widenToLargerTypesUnsupportedOtherwise(const SizeAndActionsVec &v)
LegalizeRuleSet & widenScalarToNextPow2(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar to the next power of two that is at least MinSize.
This operation is completely unsupported on the target.
void verify(const MCInstrInfo &MII) const
Perform simple self-diagnostic and assert if there is anything obviously wrong with the actions set u...
void computeTables()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
unsigned getPointerSizeInBits(unsigned AS) const
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
LegalizeRuleSet & clampScalar(unsigned TypeIdx, const LLT &MinTy, const LLT &MaxTy)
Limit the range of scalar sizes to MinTy and MaxTy.
LegalizeRuleSet & getActionDefinitionsBuilder(unsigned Opcode)
Get the action definition builder for the given opcode.
static SizeAndActionsVec narrowToSmallerAndWidenToSmallest(const SizeAndActionsVec &v)
LegalizeRuleSet & legalFor(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list.
static SizeAndActionsVec widenToLargerTypesAndNarrowToLargest(const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular operation consists of wi...
void setLegalizeScalarToDifferentSizeStrategy(const unsigned Opcode, const unsigned TypeIdx, SizeChangeStrategy S)
The setAction calls record the non-size-changing legalization actions to take on specificly-sized typ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
The operation is expected to be selectable directly by the target, and no transformation is necessary...