From patchwork Mon May 23 15:59:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 96978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A7DCBB6FB5 for ; Tue, 24 May 2011 01:59:50 +1000 (EST) Received: (qmail 16857 invoked by alias); 23 May 2011 15:59:49 -0000 Received: (qmail 16848 invoked by uid 22791); 23 May 2011 15:59:48 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_HI, TW_MV, TW_VZ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 May 2011 15:59:33 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 23 May 2011 08:59:33 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2011 08:59:33 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 19AE3180DB2; Mon, 23 May 2011 08:59:33 -0700 (PDT) Date: Mon, 23 May 2011 08:59:32 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: 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> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 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 PR target/47315 * gcc.target/i386/pr47315.c: New test. 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); +}