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

Evan Cheng evan.cheng at apple.com
Fri May 26 13:38:00 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.221 -> 1.222
---
Log message:

Vector argument must be passed in memory location aligned on 16-byte boundary.


---
Diffs of the changes:  (+18 -2)

 X86ISelLowering.cpp |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.221 llvm/lib/Target/X86/X86ISelLowering.cpp:1.222
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.221	Fri May 26 14:22:06 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp	Fri May 26 15:37:47 2006
@@ -442,6 +442,9 @@
       ArgValues.push_back(ArgValue);
       NumXMMRegs += ObjXMMRegs;
     } else {
+      // XMM arguments have to be aligned on 16-byte boundary.
+      if (ObjSize == 16)
+        ArgOffset = ((ArgOffset + 15) / 16) * 16;
       // Create the frame index object for this incoming parameter...
       int FI = MFI->CreateFixedObject(ObjSize, ArgOffset);
       SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy());
@@ -516,8 +519,11 @@
     case MVT::v2f64:
       if (NumXMMRegs < 4)
         ++NumXMMRegs;
-      else
+      else {
+        // XMM arguments have to be aligned on 16-byte boundary.
+        NumBytes = ((NumBytes + 15) / 16) * 16;
         NumBytes += 16;
+      }
       break;
     }
   }
@@ -574,6 +580,8 @@
         RegsToPass.push_back(std::make_pair(XMMArgRegs[NumXMMRegs], Arg));
         NumXMMRegs++;
       } else {
+        // XMM arguments have to be aligned on 16-byte boundary.
+        ArgOffset = ((ArgOffset + 15) / 16) * 16;
         SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy());
         PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff);
         MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain,
@@ -911,6 +919,9 @@
     }
 
     if (ObjSize) {
+      // XMM arguments have to be aligned on 16-byte boundary.
+      if (ObjSize == 16)
+        ArgOffset = ((ArgOffset + 15) / 16) * 16;
       // Create the SelectionDAG nodes corresponding to a load from this
       // parameter.
       int FI = MFI->CreateFixedObject(ObjSize, ArgOffset);
@@ -1027,8 +1038,11 @@
     case MVT::v2f64:
       if (NumXMMRegs < 4)
         NumXMMRegs++;
-      else
+      else {
+        // XMM arguments have to be aligned on 16-byte boundary.
+        NumBytes = ((NumBytes + 15) / 16) * 16;
         NumBytes += 16;
+      }
       break;
     }
   }
@@ -1088,6 +1102,8 @@
         RegsToPass.push_back(std::make_pair(XMMArgRegs[NumXMMRegs], Arg));
         NumXMMRegs++;
       } else {
+        // XMM arguments have to be aligned on 16-byte boundary.
+        ArgOffset = ((ArgOffset + 15) / 16) * 16;
         SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy());
         PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff);
         MemOpChains.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain,






More information about the llvm-commits mailing list