Skip to content

Commit

Permalink
[globalisel] Introduce LegalityQuery to better encapsulate the legali…
Browse files Browse the repository at this point in the history
…zer decisions. NFC.

Summary:
`getAction(const InstrAspect &) const` breaks encapsulation by exposing
the smaller components that are used to decide how to legalize an
instruction.

This is a problem because we need to change the implementation of
LegalizerInfo so that it's able to describe particular type combinations
rather than just cartesian products of types.

For example, declaring the following
  setAction({..., 0, s32}, Legal)
  setAction({..., 0, s64}, Legal)
  setAction({..., 1, s32}, Legal)
  setAction({..., 1, s64}, Legal)
currently declares these type combinations as legal:
  {s32, s32}
  {s64, s32}
  {s32, s64}
  {s64, s64}
but we currently have no means to say that, for example, {s64, s32} is
not legal. Some operations such as G_INSERT/G_EXTRACT/G_MERGE_VALUES/
G_UNMERGE_VALUES has relationships between the types that are currently
described incorrectly.

Additionally, G_LOAD/G_STORE currently have no means to legalize non-atomics
differently to atomics. The necessary information is in the MMO but we have no
way to use this in the legalizer. Similarly, there is currently no way for the
register type and the memory type to differ so there is no way to cleanly
represent extending-load/truncating-store in a way that can't be broken by
optimizers (resulting in illegal MIR).

This patch introduces LegalityQuery which provides all the information
needed by the legalizer to make a decision on whether something is legal
and how to legalize it.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar, volkan, reames, bogner

Reviewed By: bogner

Subscribers: bogner, llvm-commits, kristof.beyls

Differential Revision: https://reviews.llvm.org/D42244

llvm-svn: 323342
  • Loading branch information
dsandersllvm committed Jan 24, 2018
1 parent 5803a67 commit 262ed0e
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 93 deletions.
20 changes: 10 additions & 10 deletions llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class LegalizationArtifactCombiner {
MI.getOperand(1).getReg(), MRI)) {
unsigned DstReg = MI.getOperand(0).getReg();
LLT DstTy = MRI.getType(DstReg);
if (isInstUnsupported(TargetOpcode::G_AND, DstTy) ||
isInstUnsupported(TargetOpcode::G_CONSTANT, DstTy))
if (isInstUnsupported({TargetOpcode::G_AND, {DstTy}}) ||
isInstUnsupported({TargetOpcode::G_CONSTANT, {DstTy}}))
return false;
DEBUG(dbgs() << ".. Combine MI: " << MI;);
Builder.setInstr(MI);
Expand All @@ -87,9 +87,9 @@ class LegalizationArtifactCombiner {
MI.getOperand(1).getReg(), MRI)) {
unsigned DstReg = MI.getOperand(0).getReg();
LLT DstTy = MRI.getType(DstReg);
if (isInstUnsupported(TargetOpcode::G_SHL, DstTy) ||
isInstUnsupported(TargetOpcode::G_ASHR, DstTy) ||
isInstUnsupported(TargetOpcode::G_CONSTANT, DstTy))
if (isInstUnsupported({TargetOpcode::G_SHL, {DstTy}}) ||
isInstUnsupported({TargetOpcode::G_ASHR, {DstTy}}) ||
isInstUnsupported({TargetOpcode::G_CONSTANT, {DstTy}}))
return false;
DEBUG(dbgs() << ".. Combine MI: " << MI;);
Builder.setInstr(MI);
Expand Down Expand Up @@ -121,7 +121,7 @@ class LegalizationArtifactCombiner {
MI.getOperand(1).getReg(), MRI)) {
unsigned DstReg = MI.getOperand(0).getReg();
LLT DstTy = MRI.getType(DstReg);
if (isInstUnsupported(TargetOpcode::G_IMPLICIT_DEF, DstTy))
if (isInstUnsupported({TargetOpcode::G_IMPLICIT_DEF, {DstTy}}))
return false;
DEBUG(dbgs() << ".. Combine EXT(IMPLICIT_DEF) " << MI;);
Builder.setInstr(MI);
Expand Down Expand Up @@ -277,10 +277,10 @@ class LegalizationArtifactCombiner {

/// Checks if the target legalizer info has specified anything about the
/// instruction, or if unsupported.
bool isInstUnsupported(unsigned Opcode, const LLT &DstTy) const {
auto Action = LI.getAction({Opcode, 0, DstTy});
return Action.first == LegalizerInfo::LegalizeAction::Unsupported ||
Action.first == LegalizerInfo::LegalizeAction::NotFound;
bool isInstUnsupported(const LegalityQuery &Query) const {
auto Step = LI.getAction(Query);
return Step.Action == LegalizerInfo::LegalizeAction::Unsupported ||
Step.Action == LegalizerInfo::LegalizeAction::NotFound;
}
};

Expand Down
57 changes: 46 additions & 11 deletions llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ struct InstrAspect {
}
};

/// The LegalityQuery object bundles together all the information that's needed
/// to decide whether a given operation is legal or not.
/// For efficiency, it doesn't make a copy of Types so care must be taken not
/// to free it before using the query.
struct LegalityQuery {
unsigned Opcode;
ArrayRef<LLT> Types;
};

class LegalizerInfo {
public:
enum LegalizeAction : std::uint8_t {
Expand Down Expand Up @@ -100,6 +109,27 @@ class LegalizerInfo {
NotFound,
};

/// The result of a query. It either indicates a final answer of Legal or
/// Unsupported or describes an action that must be taken to make an operation
/// more legal.
struct LegalizeActionStep {
/// The action to take or the final answer.
LegalizeAction Action;
/// If describing an action, the type index to change. Otherwise zero.
unsigned TypeIdx;
/// If describing an action, the new type for TypeIdx. Otherwise LLT{}.
LLT NewType;

LegalizeActionStep(LegalizeAction Action, unsigned TypeIdx,
const LLT &NewType)
: Action(Action), TypeIdx(TypeIdx), NewType(NewType) {}

bool operator==(const LegalizeActionStep &RHS) const {
return std::tie(Action, TypeIdx, NewType) ==
std::tie(RHS.Action, RHS.TypeIdx, RHS.NewType);
}
};

LegalizerInfo();
virtual ~LegalizerInfo() = default;

Expand Down Expand Up @@ -259,22 +289,18 @@ class LegalizerInfo {
LegalizeAction DecreaseAction,
LegalizeAction IncreaseAction);

/// Determine what action should be taken to legalize the given generic
/// instruction opcode, type-index and type. Requires computeTables to have
/// been called.
/// Determine what action should be taken to legalize the described
/// instruction. Requires computeTables to have been called.
///
/// \returns a pair consisting of the kind of legalization that should be
/// performed and the destination type.
std::pair<LegalizeAction, LLT> getAction(const InstrAspect &Aspect) const;
/// \returns a description of the next legalization step to perform.
LegalizeActionStep getAction(const LegalityQuery &Query) const;

/// Determine what action should be taken to legalize the given generic
/// instruction.
///
/// \returns a tuple consisting of the LegalizeAction that should be
/// performed, the type-index it should be performed on and the destination
/// type.
std::tuple<LegalizeAction, unsigned, LLT>
getAction(const MachineInstr &MI, const MachineRegisterInfo &MRI) const;
/// \returns a description of the next legalization step to perform.
LegalizeActionStep getAction(const MachineInstr &MI,
const MachineRegisterInfo &MRI) const;

bool isLegal(const MachineInstr &MI, const MachineRegisterInfo &MRI) const;

Expand All @@ -283,6 +309,15 @@ class LegalizerInfo {
MachineIRBuilder &MIRBuilder) const;

private:
/// Determine what action should be taken to legalize the given generic
/// instruction opcode, type-index and type. Requires computeTables to have
/// been called.
///
/// \returns a pair consisting of the kind of legalization that should be
/// performed and the destination type.
std::pair<LegalizeAction, LLT>
getAspectAction(const InstrAspect &Aspect) const;

/// The SizeAndActionsVec is a representation mapping between all natural
/// numbers and an Action. The natural number represents the bit size of
/// the InstrAspect. For example, for a target with native support for 32-bit
Expand Down
14 changes: 7 additions & 7 deletions llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ LegalizerHelper::LegalizeResult
LegalizerHelper::legalizeInstrStep(MachineInstr &MI) {
DEBUG(dbgs() << "Legalizing: "; MI.print(dbgs()));

auto Action = LI.getAction(MI, MRI);
switch (std::get<0>(Action)) {
auto Step = LI.getAction(MI, MRI);
switch (Step.Action) {
case LegalizerInfo::Legal:
DEBUG(dbgs() << ".. Already legal\n");
return AlreadyLegal;
Expand All @@ -46,16 +46,16 @@ LegalizerHelper::legalizeInstrStep(MachineInstr &MI) {
return libcall(MI);
case LegalizerInfo::NarrowScalar:
DEBUG(dbgs() << ".. Narrow scalar\n");
return narrowScalar(MI, std::get<1>(Action), std::get<2>(Action));
return narrowScalar(MI, Step.TypeIdx, Step.NewType);
case LegalizerInfo::WidenScalar:
DEBUG(dbgs() << ".. Widen scalar\n");
return widenScalar(MI, std::get<1>(Action), std::get<2>(Action));
return widenScalar(MI, Step.TypeIdx, Step.NewType);
case LegalizerInfo::Lower:
DEBUG(dbgs() << ".. Lower\n");
return lower(MI, std::get<1>(Action), std::get<2>(Action));
return lower(MI, Step.TypeIdx, Step.NewType);
case LegalizerInfo::FewerElements:
DEBUG(dbgs() << ".. Reduce number of elements\n");
return fewerElementsVector(MI, std::get<1>(Action), std::get<2>(Action));
return fewerElementsVector(MI, Step.TypeIdx, Step.NewType);
case LegalizerInfo::Custom:
DEBUG(dbgs() << ".. Custom legalization\n");
return LI.legalizeCustom(MI, MRI, MIRBuilder) ? Legalized
Expand Down Expand Up @@ -924,7 +924,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty) {
// Lower (G_FSUB LHS, RHS) to (G_FADD LHS, (G_FNEG RHS)).
// First, check if G_FNEG is marked as Lower. If so, we may
// end up with an infinite loop as G_FSUB is used to legalize G_FNEG.
if (LI.getAction({G_FNEG, Ty}).first == LegalizerInfo::Lower)
if (LI.getAction({G_FNEG, {Ty}}).Action == LegalizerInfo::Lower)
return UnableToLegalize;
unsigned Res = MI.getOperand(0).getReg();
unsigned LHS = MI.getOperand(1).getReg();
Expand Down
23 changes: 16 additions & 7 deletions llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void LegalizerInfo::computeTables() {
// we have any hope of doing well with something like <13 x i3>. Even the common
// cases should do better than what we have now.
std::pair<LegalizerInfo::LegalizeAction, LLT>
LegalizerInfo::getAction(const InstrAspect &Aspect) const {
LegalizerInfo::getAspectAction(const InstrAspect &Aspect) const {
assert(TablesInitialized && "backend forgot to call computeTables");
// These *have* to be implemented for now, they're the fundamental basis of
// how everything else is transformed.
Expand All @@ -186,9 +186,20 @@ static LLT getTypeFromTypeIdx(const MachineInstr &MI,
return MRI.getType(MI.getOperand(OpIdx).getReg());
}

std::tuple<LegalizerInfo::LegalizeAction, unsigned, LLT>
LegalizerInfo::LegalizeActionStep
LegalizerInfo::getAction(const LegalityQuery &Query) const {
for (unsigned i = 0; i < Query.Types.size(); ++i) {
auto Action = getAspectAction({Query.Opcode, i, Query.Types[i]});
if (Action.first != Legal)
return {Action.first, i, Action.second};
}
return {Legal, 0, LLT{}};
}

LegalizerInfo::LegalizeActionStep
LegalizerInfo::getAction(const MachineInstr &MI,
const MachineRegisterInfo &MRI) const {
SmallVector<LLT, 2> Types;
SmallBitVector SeenTypes(8);
const MCOperandInfo *OpInfo = MI.getDesc().OpInfo;
// FIXME: probably we'll need to cache the results here somehow?
Expand All @@ -205,16 +216,14 @@ LegalizerInfo::getAction(const MachineInstr &MI,
SeenTypes.set(TypeIdx);

LLT Ty = getTypeFromTypeIdx(MI, MRI, i, TypeIdx);
auto Action = getAction({MI.getOpcode(), TypeIdx, Ty});
if (Action.first != Legal)
return std::make_tuple(Action.first, TypeIdx, Action.second);
Types.push_back(Ty);
}
return std::make_tuple(Legal, 0, LLT{});
return getAction({MI.getOpcode(), Types});
}

bool LegalizerInfo::isLegal(const MachineInstr &MI,
const MachineRegisterInfo &MRI) const {
return std::get<0>(getAction(MI, MRI)) == Legal;
return getAction(MI, MRI).Action == Legal;
}

bool LegalizerInfo::legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI,
Expand Down
117 changes: 59 additions & 58 deletions llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,29 @@ TEST(LegalizerInfoTest, ScalarRISC) {

for (unsigned opcode : {G_ADD, G_SUB}) {
// Check we infer the correct types and actually do what we're told.
ASSERT_EQ(L.getAction({opcode, LLT::scalar(8)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(16)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(32)}),
std::make_pair(LegalizerInfo::Legal, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(64)}),
std::make_pair(LegalizerInfo::Legal, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(8)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(16)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(32)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(64)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));

// Make sure the default for over-sized types applies.
ASSERT_EQ(L.getAction({opcode, LLT::scalar(128)}),
std::make_pair(LegalizerInfo::NarrowScalar, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(128)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, LLT::scalar(64)));
// Make sure we also handle unusual sizes
ASSERT_EQ(L.getAction({opcode, LLT::scalar(1)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(31)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(33)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(63)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, LLT::scalar(65)}),
std::make_pair(LegalizerInfo::NarrowScalar, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(1)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(31)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(33)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(63)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(64)));
ASSERT_EQ(L.getAction({opcode, {LLT::scalar(65)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, LLT::scalar(64)));
}
}

Expand All @@ -106,19 +106,19 @@ TEST(LegalizerInfoTest, VectorRISC) {

// Check we infer the correct types and actually do what we're told for some
// simple cases.
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(8, 8)}),
std::make_pair(LegalizerInfo::Legal, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(8, 7)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(2, 8)}),
std::make_pair(LegalizerInfo::MoreElements, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(8, 32)}),
std::make_pair(LegalizerInfo::FewerElements, LLT::vector(4, 32)));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 8)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 7)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(2, 8)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 32)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::FewerElements, 0, LLT::vector(4, 32)));
// Check a few non-power-of-2 sizes:
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(3, 3)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::vector(3, 8)));
ASSERT_EQ(L.getAction({G_ADD, LLT::vector(3, 8)}),
std::make_pair(LegalizerInfo::MoreElements, LLT::vector(8, 8)));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(3, 3)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::vector(3, 8)));
ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(3, 8)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0, LLT::vector(8, 8)));
}

TEST(LegalizerInfoTest, MultipleTypes) {
Expand All @@ -137,15 +137,16 @@ TEST(LegalizerInfoTest, MultipleTypes) {
L.computeTables();

// Check we infer the correct types and actually do what we're told.
ASSERT_EQ(L.getAction({G_PTRTOINT, 0, s64}),
std::make_pair(LegalizerInfo::Legal, s64));
ASSERT_EQ(L.getAction({G_PTRTOINT, 1, p0}),
std::make_pair(LegalizerInfo::Legal, p0));
ASSERT_EQ(L.getAction({G_PTRTOINT, {s64, p0}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));

// Make sure we also handle unusual sizes
ASSERT_EQ(L.getAction({G_PTRTOINT, 0, LLT::scalar(65)}),
std::make_pair(LegalizerInfo::NarrowScalar, s64));
ASSERT_EQ(L.getAction({G_PTRTOINT, 1, LLT::pointer(0, 32)}),
std::make_pair(LegalizerInfo::Unsupported, LLT::pointer(0, 32)));
ASSERT_EQ(
L.getAction({G_PTRTOINT, {LLT::scalar(65), s64}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, s64));
ASSERT_EQ(
L.getAction({G_PTRTOINT, {s64, LLT::pointer(0, 32)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 1, LLT::pointer(0, 32)));
}

TEST(LegalizerInfoTest, MultipleSteps) {
Expand All @@ -161,10 +162,10 @@ TEST(LegalizerInfoTest, MultipleSteps) {

L.computeTables();

ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(16)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(32)}),
std::make_pair(LegalizerInfo::Lower, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(16)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(32)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Lower, 0, LLT::scalar(32)));
}

TEST(LegalizerInfoTest, SizeChangeStrategy) {
Expand All @@ -179,20 +180,20 @@ TEST(LegalizerInfoTest, SizeChangeStrategy) {

// Check we infer the correct types and actually do what we're told.
for (unsigned Size : {1, 8, 16, 32}) {
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(Size)}),
std::make_pair(LegalizerInfo::Legal, LLT::scalar(Size)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(Size)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
}
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(2)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(8)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(7)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(8)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(9)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(16)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(17)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(31)}),
std::make_pair(LegalizerInfo::WidenScalar, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, LLT::scalar(33)}),
std::make_pair(LegalizerInfo::Unsupported, LLT::scalar(33)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(2)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(8)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(7)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(8)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(9)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(16)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(17)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(31)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(33)}}),
LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 0, LLT::scalar(33)));
}
}

0 comments on commit 262ed0e

Please sign in to comment.