diff mbox

PATCH: PR target/47315: ICE: in extract_insn, at recog.c:2109 (unrecognizable insn) with -mvzeroupper and __attribute__((target("avx")))

Message ID 20110523155932.GA1837@intel.com
State New
Headers show

Commit Message

H.J. Lu May 23, 2011, 3:59 p.m. UTC
Hi,

This patch fixes ICE by saving the initial options after checking
vzeroupper.  OK for trunk?

Thanks.


H.J.
---
gcc/

2011-05-23  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/47315
	* config/i386/i386.c (ix86_option_override_internal): Save the
	initial options after checking vzeroupper.

gcc/testsuite/

2011-05-23  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/47315
	* gcc.target/i386/pr47315.c: New test.

Comments

Uros Bizjak May 23, 2011, 4:13 p.m. UTC | #1
On Mon, May 23, 2011 at 5:59 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> This patch fixes ICE by saving the initial options after checking
> vzeroupper.  OK for trunk?
>
> Thanks.
>
>
> H.J.
> ---
> gcc/
>
> 2011-05-23  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/47315
>        * config/i386/i386.c (ix86_option_override_internal): Save the
>        initial options after checking vzeroupper.
>
> gcc/testsuite/
>
> 2011-05-23  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/47315
>        * gcc.target/i386/pr47315.c: New test.

OK for mainline.

Thanks,
Uros.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0709be8..854e376 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4191,11 +4191,6 @@  ix86_option_override_internal (bool main_args_p)
 #endif
    }
 
-  /* Save the initial options in case the user does function specific options */
-  if (main_args_p)
-    target_option_default_node = target_option_current_node
-      = build_target_option_node ();
-
   if (TARGET_AVX)
     {
       /* When not optimize for size, enable vzeroupper optimization for
@@ -4217,6 +4212,12 @@  ix86_option_override_internal (bool main_args_p)
       /* Disable vzeroupper pass if TARGET_AVX is disabled.  */
       target_flags &= ~MASK_VZEROUPPER;
     }
+
+  /* Save the initial options in case the user does function specific
+     options.  */
+  if (main_args_p)
+    target_option_default_node = target_option_current_node
+      = build_target_option_node ();
 }
 
 /* Return TRUE if VAL is passed in register with 256bit AVX modes.  */
diff --git a/gcc/testsuite/gcc.target/i386/pr47315.c b/gcc/testsuite/gcc.target/i386/pr47315.c
new file mode 100644
index 0000000..871d3f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr47315.c
@@ -0,0 +1,10 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -mvzeroupper" } */
+
+__attribute__ ((__target__ ("avx")))
+float bar (float f) {}
+
+void foo (float f)
+{
+    bar (f);
+}