mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-20 00:43:48 +00:00
Fix the JIT encoding of LWA, LD, STD, and STDU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23787 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
076866c50f
commit
841d12d9ac
@ -117,6 +117,10 @@ namespace {
|
||||
MVT::ValueType VT) {
|
||||
O << (unsigned short)MI->getOperand(OpNo).getImmedValue();
|
||||
}
|
||||
void printS16X4ImmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
MVT::ValueType VT) {
|
||||
O << (short)MI->getOperand(OpNo).getImmedValue()*4;
|
||||
}
|
||||
void printBranchOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
MVT::ValueType VT) {
|
||||
// Branches can take an immediate operand. This is used by the branch
|
||||
|
@ -89,6 +89,9 @@ def s16imm : Operand<i32> {
|
||||
def u16imm : Operand<i32> {
|
||||
let PrintMethod = "printU16ImmOperand";
|
||||
}
|
||||
def s16immX4 : Operand<i32> { // Multiply imm by 4 before printing.
|
||||
let PrintMethod = "printS16X4ImmOperand";
|
||||
}
|
||||
def target : Operand<i32> {
|
||||
let PrintMethod = "printBranchOperand";
|
||||
}
|
||||
@ -282,15 +285,15 @@ def STFD : DForm_9<54, (ops F8RC:$rS, symbolLo:$disp, GPRC:$rA),
|
||||
// DS-Form instructions. Load/Store instructions available in PPC-64
|
||||
//
|
||||
let isLoad = 1 in {
|
||||
def LWA : DSForm_1<58, 2, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
|
||||
def LWA : DSForm_1<58, 2, (ops GPRC:$rT, s16immX4:$DS, GPRC:$rA),
|
||||
"lwa $rT, $DS($rA)">, isPPC64;
|
||||
def LD : DSForm_2<58, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
|
||||
def LD : DSForm_2<58, 0, (ops GPRC:$rT, s16immX4:$DS, GPRC:$rA),
|
||||
"ld $rT, $DS($rA)">, isPPC64;
|
||||
}
|
||||
let isStore = 1 in {
|
||||
def STD : DSForm_2<62, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
|
||||
def STD : DSForm_2<62, 0, (ops GPRC:$rT, s16immX4:$DS, GPRC:$rA),
|
||||
"std $rT, $DS($rA)">, isPPC64;
|
||||
def STDU : DSForm_2<62, 1, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
|
||||
def STDU : DSForm_2<62, 1, (ops GPRC:$rT, s16immX4:$DS, GPRC:$rA),
|
||||
"stdu $rT, $DS($rA)">, isPPC64;
|
||||
}
|
||||
|
||||
|
@ -271,6 +271,15 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II) const {
|
||||
MI.SetMachineOperandReg(1, MI.getOperand(i).getReg());
|
||||
MI.SetMachineOperandReg(2, PPC::R0);
|
||||
} else {
|
||||
switch (MI.getOpcode()) {
|
||||
case PPC::LWA:
|
||||
case PPC::LD:
|
||||
case PPC::STD:
|
||||
case PPC::STDU:
|
||||
assert((Offset & 3) == 0 && "Invalid frame offset!");
|
||||
Offset >>= 2; // The actual encoded value has the low two bits zero.
|
||||
break;
|
||||
}
|
||||
MI.SetMachineOperandConst(OffIdx, MachineOperand::MO_SignExtendedImmed,
|
||||
Offset);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user