[llvm] [RISCV][GISel] Custom promote s32 G_SHL/ASHR/LSHR on RV64. (PR #115559)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 16:52:47 PST 2024


================
@@ -1223,6 +1228,36 @@ bool RISCVLegalizerInfo::legalizeCustom(
     return Helper.lower(MI, 0, /* Unused hint type */ LLT()) ==
            LegalizerHelper::Legalized;
   }
+  case TargetOpcode::G_ASHR:
+  case TargetOpcode::G_LSHR:
+  case TargetOpcode::G_SHL: {
+    Register AmtReg = MI.getOperand(2).getReg();
+    auto VRegAndVal = getIConstantVRegValWithLookThrough(AmtReg, MRI);
+    if (VRegAndVal) {
----------------
mshockwave wrote:

```suggestion
    if (getIConstantVRegValWithLookThrough(AmtReg, MRI)) {
```

https://github.com/llvm/llvm-project/pull/115559


More information about the llvm-commits mailing list