[PATCH] D152726: [RISCV][GlobalISel] Legalize all ALU instructions, excluding w-instructions

Nitin John Raj via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 08:51:02 PDT 2023


nitinjohnraj abandoned this revision.
nitinjohnraj marked 4 inline comments as done.
nitinjohnraj added a comment.

Breaking the problem into smaller chunks seems helpful.



================
Comment at: llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp:47-48
+        .legalFor({XLenLLT})
+        .libcall()
+        .clampScalar(0, XLenLLT, XLenLLT);
+  }
----------------
arsenm wrote:
> I don't think ordering libcall before anything else will work
I moved the libcall after the clampScalar, but retrospectively I think the original ordering was correct.
```
getActionDefinitionsBuilder({G_MUL, G_SDIV, G_SREM, G_UDIV, G_UREM})
          .legalFor({XLenLLT})
          .libcallFor({s128})
          .clampScalar(0, XLenLLT, XLenLLT);
```
This reads as "These opcodes are legal for XLenLLT. If that check fails, see if the type is s128 and then use a libcall. If that fails, try extending the argument 0 to XLenLLT type." That seems correct to me.


================
Comment at: llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp:49
+        .libcall()
+        .clampScalar(0, XLenLLT, XLenLLT);
+  }
----------------
tschuett wrote:
> What is the effect of the clampScalar? You are doing lib call for legal values?
If I understand correctly, this is being addressed by the conversation with arsenm above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152726



More information about the llvm-commits mailing list