[PATCH] D117264: [M68k][GlobalISel] Legalize more instruction in M68k Legalizer.

Sheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 17:14:43 PST 2022


0x59616e created this revision.
0x59616e added reviewers: myhsu, ricky26, arsenm.
Herald added subscribers: hiraditya, rovka.
0x59616e requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

The test is in reivision D116931 <https://reviews.llvm.org/D116931>


https://reviews.llvm.org/D117264

Files:
  llvm/lib/Target/M68k/GISel/M68kLegalizerInfo.cpp


Index: llvm/lib/Target/M68k/GISel/M68kLegalizerInfo.cpp
===================================================================
--- llvm/lib/Target/M68k/GISel/M68kLegalizerInfo.cpp
+++ llvm/lib/Target/M68k/GISel/M68kLegalizerInfo.cpp
@@ -18,16 +18,33 @@
 #include "llvm/IR/Type.h"
 
 using namespace llvm;
+using namespace LegalityPredicates;
 
 M68kLegalizerInfo::M68kLegalizerInfo(const M68kSubtarget &ST) {
   using namespace TargetOpcode;
-  const LLT S32 = LLT::scalar(32);
-  const LLT P0 = LLT::pointer(0, 32);
-  getActionDefinitionsBuilder(G_LOAD).legalFor({S32});
-  getActionDefinitionsBuilder(G_FRAME_INDEX).legalFor({P0});
-  getActionDefinitionsBuilder(G_ADD).legalFor({S32});
-  getActionDefinitionsBuilder(G_SUB).legalFor({S32});
-  getActionDefinitionsBuilder(G_MUL).legalFor({S32});
-  getActionDefinitionsBuilder(G_UDIV).legalFor({S32});
+  const LLT s8 = LLT::scalar(8);
+  const LLT s16 = LLT::scalar(16);
+  const LLT s32 = LLT::scalar(32);
+  const LLT p0 = LLT::pointer(0, 32);
+
+  getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_UDIV, G_AND})
+      .legalFor({s8, s16, s32})
+      .clampScalar(0, s8, s32);
+
+  getActionDefinitionsBuilder(G_CONSTANT)
+      .legalFor({s32, p0})
+      .clampScalar(0, s32, s32);
+
+  getActionDefinitionsBuilder({G_FRAME_INDEX, G_GLOBAL_VALUE}).legalFor({p0});
+
+  getActionDefinitionsBuilder({G_STORE, G_LOAD})
+      .clampScalar(0, s8, s32)
+      .legalForTypesWithMemDesc({{s32, p0, s32, 4}})
+      .legalForTypesWithMemDesc({{s16, p0, s16, 2}})
+      .legalForTypesWithMemDesc({{s8, p0, s8, 1}})
+      .legalForTypesWithMemDesc({{p0, p0, s32, 4}});
+
+  getActionDefinitionsBuilder(G_PTR_ADD).legalFor({{p0, s32}});
+
   getLegacyLegalizerInfo().computeTables();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117264.399846.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220114/2e939102/attachment.bin>


More information about the llvm-commits mailing list