From 5dcf43138d7c7fe9eaeb7bbd24c63c1b8eab99bf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 16 Nov 2006 21:45:30 +0000 Subject: [PATCH] fix a regression that I introduced. stdu should scale the offset by 4 before printing it. llvm-svn: 31791 --- lib/Target/PowerPC/PPCAsmPrinter.cpp | 11 ++++++++++- lib/Target/PowerPC/PPCInstr64Bit.td | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 47056de2ab7..41f4121f5bc 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -127,7 +127,16 @@ namespace { O << (unsigned short)MI->getOperand(OpNo).getImmedValue(); } void printS16X4ImmOperand(const MachineInstr *MI, unsigned OpNo) { - O << (short)(MI->getOperand(OpNo).getImmedValue()*4); + if (MI->getOperand(OpNo).isImmediate()) { + O << (short)(MI->getOperand(OpNo).getImmedValue()*4); + } else { + O << "lo16("; + printOp(MI->getOperand(OpNo)); + if (TM.getRelocationModel() == Reloc::PIC_) + O << "-\"L" << getFunctionNumber() << "$pb\")"; + else + O << ')'; + } } void printBranchOperand(const MachineInstr *MI, unsigned OpNo) { // Branches can take an immediate operand. This is used by the branch diff --git a/lib/Target/PowerPC/PPCInstr64Bit.td b/lib/Target/PowerPC/PPCInstr64Bit.td index 1a1b8ac2d07..7d895d8429d 100644 --- a/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/lib/Target/PowerPC/PPCInstr64Bit.td @@ -413,7 +413,7 @@ def STWU8 : DForm_1<37, (ops ptr_rc:$ea_res, G8RC:$rS, def STDU : DSForm_1<62, 1, (ops ptr_rc:$ea_res, G8RC:$rS, - symbolLo:$ptroff, ptr_rc:$ptrreg), + s16immX4:$ptroff, ptr_rc:$ptrreg), "stdu $rS, $ptroff($ptrreg)", LdStSTD, [(set ptr_rc:$ea_res, (pre_store G8RC:$rS, ptr_rc:$ptrreg, iaddroff:$ptroff))]>,