[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp

Nate Begeman natebegeman at mac.com
Sat Aug 14 23:42:40 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.64 -> 1.65
---
Log message:

Fix float to int codepath by always allocating 8 bytes for the target of a double store; optimize cmplwi generation.

---
Diffs of the changes:  (+9 -6)

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.64 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.65
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.64	Sat Aug 14 17:11:38 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Sun Aug 15 01:42:28 2004
@@ -1005,9 +1005,10 @@
   if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
     if (Class == cByte || Class == cShort || Class == cInt) {
       unsigned Op1v = CI->getRawValue() & 0xFFFF;
-
+      unsigned OpClass = (CompTy->isSigned()) ? 0 : 2;
+      
       // Treat compare like ADDI for the purposes of immediate suitability
-      if (canUseAsImmediateForOpcode(CI, 0)) {
+      if (canUseAsImmediateForOpcode(CI, OpClass)) {
         BuildMI(*MBB, IP, OpcodeImm, 2, PPC::CR0).addReg(Op0r).addSImm(Op1v);
       } else {
         unsigned Op1r = getReg(Op1, MBB, IP);
@@ -1587,7 +1588,7 @@
   } else {
     BuildMI(BB, PPC::ADJCALLSTACKDOWN, 1).addImm(0);
   }
-
+  
   BuildMI(BB, PPC::IMPLICIT_DEF, 0, PPC::LR);
   BB->push_back(CallMI);
   
@@ -1636,8 +1637,10 @@
     TM.CalledFunctions.insert(F);
   } else {  // Emit an indirect call through the CTR
     unsigned Reg = getReg(CI.getCalledValue());
-    BuildMI(BB, PPC::MTCTR, 1).addReg(Reg);
-    TheCall = BuildMI(PPC::CALLindirect, 2).addZImm(20).addZImm(0);
+    BuildMI(BB, PPC::OR, 2, PPC::R12).addReg(Reg).addReg(Reg);
+    BuildMI(BB, PPC::MTCTR, 1).addReg(PPC::R12);
+    TheCall = BuildMI(PPC::CALLindirect, 2).addZImm(20).addZImm(0)
+      .addReg(PPC::R12);
   }
 
   std::vector<ValueRecord> Args;
@@ -2780,7 +2783,7 @@
     }
 
     int ValueFrameIdx =
-      F->getFrameInfo()->CreateStackObject(SrcTy, TM.getTargetData());
+      F->getFrameInfo()->CreateStackObject(Type::DoubleTy, TM.getTargetData());
 
     if (DestTy->isSigned()) {
       unsigned TempReg = makeAnotherReg(Type::DoubleTy);






More information about the llvm-commits mailing list