diff options
author | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2019-11-26 11:16:48 +0100 |
---|---|---|
committer | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2019-11-26 11:21:01 +0100 |
commit | 3ec193fb527e697faac4ef8f30934dd7bce849a7 (patch) | |
tree | 2e8611ff38aa52710e0c2196d61f14aa50a02cd6 /llvm | |
parent | cced971fd3d6713ec4989990e1b2f42c8539f0f3 (diff) | |
download | bcm5719-llvm-3ec193fb527e697faac4ef8f30934dd7bce849a7.tar.gz bcm5719-llvm-3ec193fb527e697faac4ef8f30934dd7bce849a7.zip |
[SystemZ] Don't build a PPA instruction with an immediate 0 operand.
The improvement in the machine verifier for operand types (D63973) discovered
a bad operand in a test using a PPA instruction. It was an immediate 0 where
a register was expected.
This patch fixes this (NFC) by now making the PPA second register operand
NoRegister instead of a zero immediate in the MIR.
Review: Ulrich Weigand
https://reviews.llvm.org/D70501
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZInstrInfo.td | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp index 91cb35dd72f..c5cce39747a 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp @@ -41,8 +41,12 @@ void SystemZInstPrinter::printAddress(unsigned Base, int64_t Disp, void SystemZInstPrinter::printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O) { - if (MO.isReg()) - O << '%' << getRegisterName(MO.getReg()); + if (MO.isReg()) { + if (!MO.getReg()) + O << '0'; + else + O << '%' << getRegisterName(MO.getReg()); + } else if (MO.isImm()) O << MO.getImm(); else if (MO.isExpr()) diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td index 8b334756611..041971ca7cb 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td @@ -2069,7 +2069,7 @@ let Predicates = [FeatureProcessorAssist] in { 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)>; } //===----------------------------------------------------------------------===// |