OSDN Git Service

GlobalISel: Support G_(S|U)REM widening in LegalizerHelper
authorDiana Picus <diana.picus@linaro.org>
Tue, 18 Jul 2017 09:08:47 +0000 (09:08 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 18 Jul 2017 09:08:47 +0000 (09:08 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308278 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalISel/LegalizerHelper.cpp

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