[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
Jim Laskey
jlaskey at apple.com
Thu Aug 18 08:52:42 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelPattern.cpp updated: 1.149 -> 1.150
---
Log message:
Handle loading of 0x????0000 constants with a single instruction.
---
Diffs of the changes: (+9 -5)
PPC32ISelPattern.cpp | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
Index: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.149 llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.150
--- llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.149 Wed Aug 17 19:15:15 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp Thu Aug 18 10:52:30 2005
@@ -1738,12 +1738,16 @@
case MVT::i32:
{
int v = (int)cast<ConstantSDNode>(N)->getSignExtended();
- if (v < 32768 && v >= -32768) {
- BuildMI(BB, PPC::LI, 1, Result).addSImm(v);
- } else {
+ unsigned Hi = Hi16(v);
+ unsigned Lo = Lo16(v);
+ if (Hi && Lo) {
Tmp1 = MakeIntReg();
- BuildMI(BB, PPC::LIS, 1, Tmp1).addSImm(v >> 16);
- BuildMI(BB, PPC::ORI, 2, Result).addReg(Tmp1).addImm(v & 0xFFFF);
+ BuildMI(BB, PPC::LIS, 1, Tmp1).addSImm(Hi);
+ BuildMI(BB, PPC::ORI, 2, Result).addReg(Tmp1).addImm(Lo);
+ } else if (Lo) {
+ BuildMI(BB, PPC::LI, 1, Result).addSImm(Lo);
+ } else {
+ BuildMI(BB, PPC::LIS, 1, Result).addSImm(Hi);
}
}
}
More information about the llvm-commits
mailing list