[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCISelDAGToDAG.cpp
Nate Begeman
natebegeman at mac.com
Mon Dec 19 15:40:54 PST 2005
Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.130 -> 1.131
PPCISelDAGToDAG.cpp updated: 1.144 -> 1.145
---
Log message:
Fix a couple of the FIXMEs, thanks to suggestion from Chris. This allows
us to load and store vectors directly at a pointer (offset of zero) by
using r0 as the base register. This also requires some asm printer work
to satisfy the darwin assembler.
For
void %foo(<4 x float> * %a) {
entry:
%tmp1 = load <4 x float> * %a;
%tmp2 = add <4 x float> %tmp1, %tmp1
store <4 x float> %tmp2, <4 x float> *%a
ret void
}
We now produce:
_foo:
lvx v0, 0, r3
vaddfp v0, v0, v0
stvx v0, 0, r3
blr
Instead of:
_foo:
li r2, 0
lvx v0, r2, r3
vaddfp v0, v0, v0
stvx v0, r2, r3
blr
---
Diffs of the changes: (+10 -5)
PPCAsmPrinter.cpp | 9 ++++++++-
PPCISelDAGToDAG.cpp | 6 ++----
2 files changed, 10 insertions(+), 5 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.130 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.131
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.130 Mon Dec 19 17:25:09 2005
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Mon Dec 19 17:40:42 2005
@@ -189,7 +189,14 @@
O << ')';
}
void printMemRegReg(const MachineInstr *MI, unsigned OpNo) {
- printOperand(MI, OpNo);
+ // When used as the base register, r0 reads constant zero rather than
+ // the value contained in the register. For this reason, the darwin
+ // assembler requires that we print r0 as 0 (no r) when used as the base.
+ const MachineOperand &MO = MI->getOperand(OpNo);
+ if (MO.getReg() == PPC::R0)
+ O << '0';
+ else
+ O << TM.getRegisterInfo()->get(MO.getReg()).Name;
O << ", ";
printOperand(MI, OpNo+1);
}
Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.144 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.145
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.144 Mon Dec 19 17:25:09 2005
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Dec 19 17:40:42 2005
@@ -454,8 +454,7 @@
return true;
}
- // FIXME: This should be a CopyFromReg R0 rather than a load of 0.
- Base = CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(0));
+ Base = CurDAG->getRegister(PPC::R0, MVT::i32);
Index = Select(N);
return true;
}
@@ -470,8 +469,7 @@
return true;
}
- // FIXME: This should be a CopyFromReg R0 rather than a load of 0.
- Base = CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(0));
+ Base = CurDAG->getRegister(PPC::R0, MVT::i32);
Index = Select(N);
return true;
}
More information about the llvm-commits
mailing list