[PATCH] D70501: [SystemZ] Don't build a PPA instruction with an immediate 0

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 04:05:42 PST 2019


jonpa updated this revision to Diff 230872.
jonpa added a comment.

> I see there's a special node "zero_reg" -- does this work?

Ah yes, that must be what I was looking for :-)

This builds a register operand with NoReg, which then makes the IR correct while it is also necessary to handle this in the AsmPrinter since otherwise the call to get the register name will fail.


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

https://reviews.llvm.org/D70501

Files:
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/SystemZ/SystemZInstrInfo.td


Index: llvm/lib/Target/SystemZ/SystemZInstrInfo.td
===================================================================
--- llvm/lib/Target/SystemZ/SystemZInstrInfo.td
+++ llvm/lib/Target/SystemZ/SystemZInstrInfo.td
@@ -2069,7 +2069,7 @@
     def PPA : SideEffectTernaryRRFc<"ppa", 0xB2E8, GR64, GR64, imm32zx4>;
   def : Pat<(int_s390_ppa_txassist GR32:$src),
             (PPA (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$src, subreg_l32),
-                 0, 1)>;
+                 zero_reg, 1)>;
 }
 
 //===----------------------------------------------------------------------===//
Index: llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -501,6 +501,15 @@
     }
     break;
 
+  case SystemZ::PPA:
+    assert(MI->getOperand(1).getReg() == SystemZ::NoRegister &&
+           "Expected PPA to have NoRegister as second register.");
+    LoweredMI = MCInstBuilder(SystemZ::PPA)
+      .addReg(MI->getOperand(0).getReg())
+      .addImm(0)
+      .addImm(MI->getOperand(2).getImm());
+    break;
+
   case TargetOpcode::FENTRY_CALL:
     LowerFENTRY_CALL(*MI, Lower);
     return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70501.230872.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/c7a8f791/attachment.bin>


More information about the llvm-commits mailing list