[PATCH] D157678: [RISCV][GISel] Remove legalIf from G_ZEXT, G_SEXT, G_ANYEXT.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 23:24:54 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: nitinjohnraj, arsenm.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: wangpc, eopXD, MaskRay, wdng.
Herald added a project: LLVM.

I think after making G_SEXT_INREG legal this isn't needed. At the
very least its not tested anymore.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157678

Files:
  llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp


Index: llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -43,29 +43,8 @@
       .clampScalar(1, XLenLLT, XLenLLT)
       .clampScalar(0, XLenLLT, XLenLLT);
 
-  // Extensions
-  auto ExtLegalFunc = [=](const LegalityQuery &Query) {
-    unsigned DstSize = Query.Types[0].getSizeInBits();
-
-    // Make sure that we have something that will fit in a register, and
-    // make sure it's a power of 2.
-    if (DstSize < 8 || DstSize > XLen || !isPowerOf2_32(DstSize))
-      return false;
-
-    const LLT SrcTy = Query.Types[1];
-
-    // Make sure we fit in a register otherwise. Don't bother checking that
-    // the source type is below 2 * XLen bits. We shouldn't be allowing anything
-    // through which is wider than the destination in the first place.
-    unsigned SrcSize = SrcTy.getSizeInBits();
-    if (SrcSize < 8 || !isPowerOf2_32(SrcSize))
-      return false;
-
-    return true;
-  };
   getActionDefinitionsBuilder({G_ZEXT, G_SEXT, G_ANYEXT})
-      .legalIf(ExtLegalFunc)
-      .clampScalar(0, XLenLLT, XLenLLT);
+      .maxScalar(0, XLenLLT);
 
   getActionDefinitionsBuilder(G_SEXT_INREG)
       .legalFor({XLenLLT})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157678.549253.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230811/bb8caee4/attachment.bin>


More information about the llvm-commits mailing list