diff options
| author | Nate Begeman <natebegeman@mac.com> | 2005-03-28 23:08:54 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2005-03-28 23:08:54 +0000 |
| commit | 731bed10c72090096fa53cbe7f243077d5d8f423 (patch) | |
| tree | 7bdac0d91bdea1bdd3b42d245eaf7a8a0e58506f /llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | |
| parent | 66acad746f0e383c46ba0140fc9f4533606ecf0e (diff) | |
| download | bcm5719-llvm-731bed10c72090096fa53cbe7f243077d5d8f423.tar.gz bcm5719-llvm-731bed10c72090096fa53cbe7f243077d5d8f423.zip | |
Pattern ISel: fix argument loading for i64s (thanks chris)
Simple ISel: fix i64 subtract
llvm-svn: 20903
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp index 42064b99c64..0044b05f541 100644 --- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp @@ -2389,7 +2389,7 @@ void PPC32ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, unsigned DestReg) { // Arithmetic and Bitwise operators static const unsigned OpcodeTab[] = { - PPC::ADD, PPC::SUB, PPC::AND, PPC::OR, PPC::XOR + PPC::ADD, PPC::SUBF, PPC::AND, PPC::OR, PPC::XOR }; static const unsigned LongOpTab[2][5] = { { PPC::ADDC, PPC::SUBFC, PPC::AND, PPC::OR, PPC::XOR }, @@ -2444,6 +2444,17 @@ void PPC32ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, unsigned Op0r = getReg(Op0, MBB, IP); unsigned Op1r = getReg(Op1, MBB, IP); + // Subtracts have their operands swapped + if (OperatorClass == 1) { + if (Class != cLong) { + BuildMI(*MBB, IP, PPC::SUBF, 2, DestReg).addReg(Op1r).addReg(Op0r); + } else { + BuildMI(*MBB, IP, PPC::SUBFC, 2, DestReg+1).addReg(Op1r+1).addReg(Op0r+1); + BuildMI(*MBB, IP, PPC::SUBFE, 2, DestReg).addReg(Op1r).addReg(Op0r); + } + return; + } + if (Class != cLong) { unsigned Opcode = OpcodeTab[OperatorClass]; BuildMI(*MBB, IP, Opcode, 2, DestReg).addReg(Op0r).addReg(Op1r); @@ -3876,7 +3887,7 @@ void PPC32ISel::visitAllocaInst(AllocaInst &I) { .addImm(0).addImm(27); // Subtract size from stack pointer, thereby allocating some space. - BuildMI(BB, PPC::SUB, 2, PPC::R1).addReg(PPC::R1).addReg(AlignedSize); + BuildMI(BB, PPC::SUBF, 2, PPC::R1).addReg(AlignedSize).addReg(PPC::R1); // Put a pointer to the space into the result register, by copying // the stack pointer. |

