[PATCH] D118702: [GlobalISel] Allow handling G_MUL with libcalls in LegalizerHelper

Lewis Revill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 07:11:59 PST 2022


lewis-revill created this revision.
lewis-revill added reviewers: arsenm, bkramer, simoncook, asb.
Herald added subscribers: luke957, luismarques, s.egerton, PkmX, hiraditya, rovka.
lewis-revill requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

If we need to handle G_MUL using a libcall (EG in RISC-V when multiplication is not supported), this should be possible using LegalizerHelper. This patch simply adds the missing cases to make sure this is possible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118702

Files:
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp


Index: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -494,6 +494,8 @@
   } while (0)
 
   switch (Opcode) {
+  case TargetOpcode::G_MUL:
+    RTLIBCASE_INT(MUL_I);
   case TargetOpcode::G_SDIV:
     RTLIBCASE_INT(SDIV_I);
   case TargetOpcode::G_UDIV:
@@ -792,6 +794,7 @@
   switch (MI.getOpcode()) {
   default:
     return UnableToLegalize;
+  case TargetOpcode::G_MUL:
   case TargetOpcode::G_SDIV:
   case TargetOpcode::G_UDIV:
   case TargetOpcode::G_SREM:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118702.404926.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/3daecc31/attachment.bin>


More information about the llvm-commits mailing list