[cfe-commits] r134951 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGen/x86_64-arguments.c

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Mon Jul 11 18:27:38 PDT 2011


Author: bruno
Date: Mon Jul 11 20:27:38 2011
New Revision: 134951

URL: http://llvm.org/viewvc/llvm-project?rev=134951&view=rev
Log:
Do the same as r134946 for arrays. Add more testcases for avx x86_64 arg
passing.

Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/test/CodeGen/x86_64-arguments.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=134951&r1=134950&r2=134951&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Jul 11 20:27:38 2011
@@ -1198,6 +1198,13 @@
     Current = NoClass;
     uint64_t EltSize = getContext().getTypeSize(AT->getElementType());
     uint64_t ArraySize = AT->getSize().getZExtValue();
+
+    // The only case a 256-bit wide vector could be used is when the array
+    // contains a single 256-bit element. Since Lo and Hi logic isn't extended
+    // to work for sizes wider than 128, early check and fallback to memory.
+    if (Size > 128 && EltSize != 256)
+      return;
+
     for (uint64_t i=0, Offset=OffsetBase; i<ArraySize; ++i, Offset += EltSize) {
       Class FieldLo, FieldHi;
       classify(AT->getElementType(), Offset, FieldLo, FieldHi);

Modified: cfe/trunk/test/CodeGen/x86_64-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-arguments.c?rev=134951&r1=134950&r2=134951&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_64-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_64-arguments.c Mon Jul 11 20:27:38 2011
@@ -277,9 +277,9 @@
 void f37(__m256 x);
 void f39() { f38(x38); f37(x37); }
 
-// Make sure that the struct below is passed in the same way
-// regardless of avx being used
-//
+// The two next tests make sure that the struct below is passed
+// in the same way regardless of avx being used
+
 // CHECK: declare void @func40(%struct.t128* byval align 16)
 typedef float __m128 __attribute__ ((__vector_size__ (16)));
 typedef struct t128 {
@@ -292,3 +292,15 @@
   func40(s);
 }
 
+// CHECK: declare void @func42(%struct.t128_2* byval align 16)
+typedef struct xxx {
+  __m128 array[2];
+} Atwo128;
+typedef struct t128_2 {
+  Atwo128 x;
+} SA;
+
+extern void func42(SA s);
+void func43(SA s) {
+  func42(s);
+}





More information about the cfe-commits mailing list