GlobalISel: Support G_(S|U)REM widening in LegalizerHelper

Treat widening G_SREM and G_UREM the same as G_SDIV and G_UDIV. This is
going to be used in the ARM backend (and that's when the test will come
too).

llvm-svn: 308278
This commit is contained in:
Diana Picus 2017-07-18 09:08:47 +00:00
parent 7f633dfe99
commit df4100b3d2
1 changed files with 3 additions and 0 deletions

View File

@ -433,9 +433,12 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) {
} }
case TargetOpcode::G_SDIV: case TargetOpcode::G_SDIV:
case TargetOpcode::G_UDIV: case TargetOpcode::G_UDIV:
case TargetOpcode::G_SREM:
case TargetOpcode::G_UREM:
case TargetOpcode::G_ASHR: case TargetOpcode::G_ASHR:
case TargetOpcode::G_LSHR: { case TargetOpcode::G_LSHR: {
unsigned ExtOp = MI.getOpcode() == TargetOpcode::G_SDIV || unsigned ExtOp = MI.getOpcode() == TargetOpcode::G_SDIV ||
MI.getOpcode() == TargetOpcode::G_SREM ||
MI.getOpcode() == TargetOpcode::G_ASHR MI.getOpcode() == TargetOpcode::G_ASHR
? TargetOpcode::G_SEXT ? TargetOpcode::G_SEXT
: TargetOpcode::G_ZEXT; : TargetOpcode::G_ZEXT;