diff mbox

PATCH: PR target/46285: ICE: in final_scan_insn, at final.c:2642 with -mavx -fsplit-stack

Message ID 20101103044253.GA771@intel.com
State New
Headers show

Commit Message

H.J. Lu Nov. 3, 2010, 4:42 a.m. UTC
Hi,

We should generate avx_vzeroupper after reload is completed.  OK for
trunk?

Thanks.


H.J.
---
gcc/

2010-11-02  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-02  H.J. Lu  <hongjiu.lu@intel.com>

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

Comments

Uros Bizjak Nov. 3, 2010, 7:05 a.m. UTC | #1
On Wed, Nov 3, 2010 at 5:42 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> We should generate avx_vzeroupper after reload is completed.  OK for
> trunk?
>
> 2010-11-02  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.

OK.

Thanks,
Uros.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index afecc89..ba1e4fc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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);
diff --git a/gcc/testsuite/gcc.target/i386/pr46285.c b/gcc/testsuite/gcc.target/i386/pr46285.c
new file mode 100644
index 0000000..b8bad6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr46285.c
@@ -0,0 +1,5 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx -fsplit-stack -mtune=generic -dp" } */
+
+typedef char __m256 __attribute__ ((__vector_size__ (32)));
+void foo (__m256 x) {}