Generate avx_vzeroupper after reload is completed.
authorH.J. Lu <hongjiu.lu@intel.com>
Wed, 3 Nov 2010 12:02:06 +0000 (12:02 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 3 Nov 2010 12:02:06 +0000 (05:02 -0700)
gcc/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

PR target/46285
* config/i386/i386.c (ix86_expand_call): Conditionally decorate
calls with UNSPEC_CALL_NEEDS_VZEROUPPER unspec before reload
is completed.

gcc/testsuite/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

PR target/46285
* gcc.target/i386/pr46285.c.

From-SVN: r166240

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

index 76ebd7e823685b08bd7906ff5adf5a0fe5dc7db5..55b233d3318e07a16f3b73cedc08fe7ff6913caa 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/46285
+       * config/i386/i386.c (ix86_expand_call): Conditionally decorate
+       calls with UNSPEC_CALL_NEEDS_VZEROUPPER unspec before reload
+       is completed.
+
 2010-11-03  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/46217
index afecc8935da40d2d3a7d3f83e21e008f7a907cb2..ba1e4fc51492db9f47563fa6b44238fa65c0144c 100644 (file)
@@ -21540,10 +21540,16 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
       else
        avx256 = call_no_avx256;
 
-      unspec = gen_rtx_UNSPEC (VOIDmode,
-                              gen_rtvec (1, GEN_INT (avx256)),
-                              UNSPEC_CALL_NEEDS_VZEROUPPER);
-      call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, unspec));
+      if (reload_completed)
+       emit_insn (gen_avx_vzeroupper (GEN_INT (avx256)));
+      else
+       {
+         unspec = gen_rtx_UNSPEC (VOIDmode,
+                                  gen_rtvec (1, GEN_INT (avx256)),
+                                  UNSPEC_CALL_NEEDS_VZEROUPPER);
+         call = gen_rtx_PARALLEL (VOIDmode,
+                                  gen_rtvec (2, call, unspec));
+       }
     }
 
   call = emit_call_insn (call);
index 86ff763f05cbcba1c3d52e58c2248e4939f02f0c..29f4dc3b8191fb6d00174cfe17462644b0b17cb5 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/46285
+       * gcc.target/i386/pr46285.c.
+
 2010-11-03  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/46217
diff --git a/gcc/testsuite/gcc.target/i386/pr46285.c b/gcc/testsuite/gcc.target/i386/pr46285.c
new file mode 100644 (file)
index 0000000..8b8cbcf
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx -fsplit-stack -mtune=generic" } */
+
+typedef char __m256 __attribute__ ((__vector_size__ (32)));
+void foo (__m256 x) {}