[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
Mon Aug 14 15:02:21 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc95361e01e15: [RISCV][GISel] Remove legalIf from G_ZEXT, G_SEXT, G_ANYEXT. (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157678/new/

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
@@ -44,29 +44,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.550102.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230814/3dba7bf8/attachment.bin>


More information about the llvm-commits mailing list