[cfe-commits] r65264 - /cfe/trunk/lib/CodeGen/CGCall.cpp
Daniel Dunbar
daniel at zuster.org
Sat Feb 21 20:48:23 PST 2009
Author: ddunbar
Date: Sat Feb 21 22:48:22 2009
New Revision: 65264
URL: http://llvm.org/viewvc/llvm-project?rev=65264&view=rev
Log:
x86_64 ABI: Pass 32-bit vectors as Integer to match gcc. We don't care
about these much but <2 x i16> shows up in the gcc test suite.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=65264&r1=65263&r2=65264&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sat Feb 21 22:48:22 2009
@@ -497,6 +497,10 @@
// class for Class pairs with appropriate constructor methods for
// the various situations.
+ // FIXME: Some of the split computations are wrong; unaligned
+ // vectors shouldn't be passed in registers for example, so there is
+ // no chance they can straddle an eightbyte. Verify & simplify.
+
Lo = Hi = NoClass;
Class &Current = OffsetBase < 64 ? Lo : Hi;
@@ -523,7 +527,18 @@
Current = Integer;
} else if (const VectorType *VT = Ty->getAsVectorType()) {
uint64_t Size = Context.getTypeSize(VT);
- if (Size == 64) {
+ if (Size == 32) {
+ // gcc passes all <4 x char>, <2 x short>, <1 x int>, <1 x
+ // float> as integer.
+ Current = Integer;
+
+ // If this type crosses an eightbyte boundary, it should be
+ // split.
+ uint64_t EB_Real = (OffsetBase) / 64;
+ uint64_t EB_Imag = (OffsetBase + Size - 1) / 64;
+ if (EB_Real != EB_Imag)
+ Hi = Lo;
+ } else if (Size == 64) {
// gcc passes <1 x double> in memory. :(
if (VT->getElementType()->isSpecificBuiltinType(BuiltinType::Double))
return;
More information about the cfe-commits
mailing list