[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

Evan Cheng evan.cheng at apple.com
Tue Jan 31 15:20:06 PST 2006



Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.72 -> 1.73
---
Log message:

Be smarter about whether to store the SSE return value in memory. If
it is already available in memory, do a fld directly from there.


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

 X86ISelLowering.cpp |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.72 llvm/lib/Target/X86/X86ISelLowering.cpp:1.73
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.72	Tue Jan 31 16:28:30 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp	Tue Jan 31 17:19:54 2006
@@ -1912,20 +1912,27 @@
         Ops.push_back(Op.getOperand(1));
         Copy = DAG.getNode(X86ISD::FP_SET_RESULT, Tys, Ops);
       } else {
-        // Spill the value to memory and reload it into top of stack.
-        unsigned Size = MVT::getSizeInBits(ArgVT)/8;
-        MachineFunction &MF = DAG.getMachineFunction();
-        int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size);
-        SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
-        SDOperand Chain = DAG.getNode(ISD::STORE, MVT::Other, Op.getOperand(0), 
-                                      Op.getOperand(1), StackSlot, 
-                                      DAG.getSrcValue(0));
+        SDOperand MemLoc, Chain;
+        SDOperand Value = Op.getOperand(1);
+
+        if (Value.getOpcode() == ISD::LOAD) {
+          Chain  = Value.getOperand(0);
+          MemLoc = Value.getOperand(1);
+        } else {
+          // Spill the value to memory and reload it into top of stack.
+          unsigned Size = MVT::getSizeInBits(ArgVT)/8;
+          MachineFunction &MF = DAG.getMachineFunction();
+          int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size);
+          MemLoc = DAG.getFrameIndex(SSFI, getPointerTy());
+          Chain = DAG.getNode(ISD::STORE, MVT::Other, Op.getOperand(0), 
+                              Value, MemLoc, DAG.getSrcValue(0));
+        }
         std::vector<MVT::ValueType> Tys;
         Tys.push_back(MVT::f64);
         Tys.push_back(MVT::Other);
         std::vector<SDOperand> Ops;
         Ops.push_back(Chain);
-        Ops.push_back(StackSlot);
+        Ops.push_back(MemLoc);
         Ops.push_back(DAG.getValueType(ArgVT));
         Copy = DAG.getNode(X86ISD::FLD, Tys, Ops);
         Tys.clear();






More information about the llvm-commits mailing list