Hi,

We should warn passing SSE vector argument without SSE enabled changes
the ABI for 64-bit. Tested on Linux/x86-64.  OK to install?

Thanks.

H.J.
---
gcc/

2012-05-20  H.J. Lu  <hongjiu...@intel.com>

        PR target/53425
        * config/i386/i386.c (type_natural_mode): Warn passing SSE
        vector argument without SSE enabled changes the ABI.

gcc/testsuite/

2012-05-20  H.J. Lu  <hongjiu...@intel.com>

        PR target/53425
        * gcc.target/i386/pr53425.c: New file.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index eca542c..a56847a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5828,7 +5833,22 @@ type_natural_mode (const_tree type, const 
CUMULATIVE_ARGS *cum)
                    return TYPE_MODE (type);
                  }
                else
-                 return mode;
+                 {
+                   if (size == 16 && !TARGET_SSE)
+                     {
+                       static bool warnedsse;
+
+                       if (cum
+                           && !warnedsse
+                           && cum->warn_sse)
+                         {
+                           warnedsse = true;
+                           warning (0, "SSE vector argument without SSE "
+                                    "enabled changes the ABI");
+                         }
+                     }
+                   return mode;
+                 }
              }
 
          gcc_unreachable ();
diff --git a/gcc/testsuite/gcc.target/i386/pr53425.c 
b/gcc/testsuite/gcc.target/i386/pr53425.c
new file mode 100644
index 0000000..2446c0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr53425.c
@@ -0,0 +1,14 @@
+/* PR target/53425 */
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-O2 -mno-sse" } */
+
+typedef double __v2df __attribute__ ((__vector_size__ (16)));
+
+extern __v2df x;
+
+extern void bar (__v2df);
+void
+foo (void)
+{
+  bar (x); /* { dg-message "warning: SSE vector argument without SSE enabled 
changes the ABI" } */
+}

Reply via email to