forked from OSchip/llvm-project
[ARM GlobalISel] Add support for s64 G_ADD and G_SUB.
Teach RegisterBankInfo to use the correct register class, and tell the legalizer it's legal. Everything else just works. The one thing that's slightly weird about this compared to SelectionDAG isel is that legalization can't distinguish between i64 and <1 x i64>, so we might end up with more NEON instructions than the user expects. Differential Revision: https://reviews.llvm.org/D63585 llvm-svn: 363989
This commit is contained in:
parent
75e23f8523
commit
25f08a17c3
|
@ -84,10 +84,19 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
|
|||
getActionDefinitionsBuilder({G_SEXT, G_ZEXT, G_ANYEXT})
|
||||
.legalForCartesianProduct({s8, s16, s32}, {s1, s8, s16});
|
||||
|
||||
getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR})
|
||||
getActionDefinitionsBuilder({G_MUL, G_AND, G_OR, G_XOR})
|
||||
.legalFor({s32})
|
||||
.minScalar(0, s32);
|
||||
|
||||
if (ST.hasNEON())
|
||||
getActionDefinitionsBuilder({G_ADD, G_SUB})
|
||||
.legalFor({s32, s64})
|
||||
.minScalar(0, s32);
|
||||
else
|
||||
getActionDefinitionsBuilder({G_ADD, G_SUB})
|
||||
.legalFor({s32})
|
||||
.minScalar(0, s32);
|
||||
|
||||
getActionDefinitionsBuilder({G_ASHR, G_LSHR, G_SHL})
|
||||
.legalFor({{s32, s32}})
|
||||
.minScalar(0, s32)
|
||||
|
|
|
@ -228,7 +228,15 @@ ARMRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
|||
|
||||
switch (Opc) {
|
||||
case G_ADD:
|
||||
case G_SUB:
|
||||
case G_SUB: {
|
||||
// Integer operations where the source and destination are in the
|
||||
// same register class.
|
||||
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
|
||||
OperandsMapping = Ty.getSizeInBits() == 64
|
||||
? &ARM::ValueMappings[ARM::DPR3OpsIdx]
|
||||
: &ARM::ValueMappings[ARM::GPR3OpsIdx];
|
||||
break;
|
||||
}
|
||||
case G_MUL:
|
||||
case G_AND:
|
||||
case G_OR:
|
||||
|
|
Loading…
Reference in New Issue