]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Set callee_pass_avx256_p before emitting call instruction
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 22 Mar 2013 16:36:22 +0000 (16:36 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 22 Mar 2013 16:36:22 +0000 (09:36 -0700)
gcc/

PR target/56560
* config/i386/i386.c (init_cumulative_args): Also set
cum->callee_return_avx256_p.
(ix86_function_arg): Set cum->callee_pass_avx256_p.  Set
cfun->machine->callee_pass_avx256_p only when MODE == VOIDmode.

* config/i386/i386.h (ix86_args): Add callee_pass_avx256_p and
callee_return_avx256_p.

gcc/

PR target/56560
* gcc.target/i386/pr56560.c: New file.

From-SVN: r196976

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr56560.c [new file with mode: 0644]

index eb03093257694cb37e86b537e8943d0642604ffd..b3e8c439fdb571097489c0cba10553a7157ad004 100644 (file)
@@ -1,3 +1,14 @@
+2013-03-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/56560
+       * config/i386/i386.c (init_cumulative_args): Also set
+       cum->callee_return_avx256_p.
+       (ix86_function_arg): Set cum->callee_pass_avx256_p.  Set
+       cfun->machine->callee_pass_avx256_p only when MODE == VOIDmode.
+
+       * config/i386/i386.h (ix86_args): Add callee_pass_avx256_p and
+       callee_return_avx256_p.
+
 2013-03-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        Backport from mainline:
index c1f6c880c81df725294b792babcc4800f3df5974..7a441c73237445f3c9f83cb5d9d33f3884a95f04 100644 (file)
@@ -5592,7 +5592,10 @@ init_cumulative_args (CUMULATIVE_ARGS *cum,  /* Argument info to initialize */
        {
          /* The return value of this function uses 256bit AVX modes.  */
          if (caller)
-           cfun->machine->callee_return_avx256_p = true;
+           {
+             cfun->machine->callee_return_avx256_p = true;
+             cum->callee_return_avx256_p = true;
+           }
          else
            cfun->machine->caller_return_avx256_p = true;
        }
@@ -6863,11 +6866,20 @@ ix86_function_arg (cumulative_args_t cum_v, enum machine_mode omode,
     {
       /* This argument uses 256bit AVX modes.  */
       if (cum->caller)
-       cfun->machine->callee_pass_avx256_p = true;
+       cum->callee_pass_avx256_p = true;
       else
        cfun->machine->caller_pass_avx256_p = true;
     }
 
+  if (cum->caller && mode == VOIDmode)
+    {
+      /* This function is called with MODE == VOIDmode immediately
+        before the call instruction is emitted.  We copy callee 256bit
+        AVX info from the current CUM here.  */
+      cfun->machine->callee_return_avx256_p = cum->callee_return_avx256_p;
+      cfun->machine->callee_pass_avx256_p = cum->callee_pass_avx256_p;
+    }
+
   return arg;
 }
 
index 80d19f1daf21ba26a7601d89b7754ce6ff73e5c3..899678d579b60509e625323556e74589cb3aae8f 100644 (file)
@@ -1502,6 +1502,10 @@ typedef struct ix86_args {
                                   in SSE registers.  Otherwise 0.  */
   enum calling_abi call_abi;   /* Set to SYSV_ABI for sysv abi. Otherwise
                                   MS_ABI for ms abi.  */
+  /* Nonzero if it passes 256bit AVX modes.  */
+  BOOL_BITFIELD callee_pass_avx256_p : 1;
+  /* Nonzero if it returns 256bit AVX modes.  */
+  BOOL_BITFIELD callee_return_avx256_p : 1;
 } CUMULATIVE_ARGS;
 
 /* Initialize a variable CUM of type CUMULATIVE_ARGS
index cb7a1a0b64362935ba2fedad6bff1b417aeab885..eae340a83df2128fa87cc1c63056db36a92366a1 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/56560
+       * gcc.target/i386/pr56560.c: New file.
+
 2013-03-15  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/56615
diff --git a/gcc/testsuite/gcc.target/i386/pr56560.c b/gcc/testsuite/gcc.target/i386/pr56560.c
new file mode 100644 (file)
index 0000000..5417cbd
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx -mvzeroupper -dp" } */
+
+extern void abort (void);
+
+typedef double vec_t __attribute__((vector_size(32)));
+
+struct S { int i1; int i2; int i3; };
+
+extern int bar (vec_t, int, int, int, int, int, struct S);
+
+void foo (vec_t v, struct S s)
+{
+  int i = bar (v, 1, 2, 3, 4, 5, s);
+  if (i == 0)
+    abort ();
+}
+
+/* { dg-final { scan-assembler-not "avx_vzeroupper" } } */