From patchwork Tue Nov 13 21:50:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 198792 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 62C092C0093 for ; Wed, 14 Nov 2012 08:53:02 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353448383; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=IyeOat9l9YwWvcC+Y041vI+hK20=; b=gHBPFvLcZDCLJBm USt0uPQ7PKswCFlzkwXaY5tUZxRnQXnBrNHPohCysg/0iv04sXJbNKp/PjCP+woS xHbo9uOSRQRVMlWLdF2dpWaTNR4qINwJ1mIS/aeQHCbJtmCSVBvuIH7wuE2oTLSQ zzXywXVc77qZVOoTQmmLc/qjs/Mc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-ID:User-Agent:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mlPHEQZqOZ8BpTEOX/LWNz2/KX0YR/FCOnUXL06RkVhV4dBTUDE6h/HRWRPwvC qBWL/w4XyPhdR5D0gGMEGHub3geNLIqQ/5EWsTkK/rkKMJLyjdZjLOXW3ft5WjNY u/kL/3/lHVERSq9fP3jaOOJ1T6SN5BkRp/zd1c3bCutoo=; Received: (qmail 15969 invoked by alias); 13 Nov 2012 21:52:59 -0000 Received: (qmail 15961 invoked by uid 22791); 13 Nov 2012 21:52:59 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Nov 2012 21:52:50 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 34843CB1045; Tue, 13 Nov 2012 22:52:52 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xPWkiKe73xLt; Tue, 13 Nov 2012 22:52:52 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id E8CD8CB061D; Tue, 13 Nov 2012 22:52:51 +0100 (CET) From: Eric Botcazou To: David Miller Cc: gcc-patches@gcc.gnu.org, ro@cebitec.uni-bielefeld.de Subject: Re: [PATCH v3] Add support for sparc compare-and-branch Date: Tue, 13 Nov 2012 22:50:49 +0100 Message-ID: <6508428.jNPiT7s7BC@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) In-Reply-To: <20121113.144058.1489444750556522789.davem@davemloft.net> References: <1967849.TQiz8OpHdv@polaris> <20121113.144058.1489444750556522789.davem@davemloft.net> MIME-Version: 1.0 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 > Thanks for finding this, that's definitely incorrect behavior. I bet there > is some unintended override triggered by sparc4 selection, and I'll go and > fix that soon. You're welcome. That's the reason why I needed to go the ASM_ARCH way, the straightforward approach would have put the -32/-64 first. And I managed to miss a substitution in the previous patch, so please drop it and use the attached one instead. Index: config/sparc/sparc.h =================================================================== --- config/sparc/sparc.h (revision 193416) +++ config/sparc/sparc.h (working copy) @@ -195,7 +195,7 @@ extern enum cmodel sparc_cmodel; #endif #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara4 #define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__" -#define ASM_CPU64_DEFAULT_SPEC "-Av9" AS_NIAGARA3_FLAG +#define ASM_CPU64_DEFAULT_SPEC AS_NIAGARA4_FLAG #endif #else @@ -337,7 +337,7 @@ extern enum cmodel sparc_cmodel; %{mcpu=niagara:%{!mv8plus:-Av9b}} \ %{mcpu=niagara2:%{!mv8plus:-Av9b}} \ %{mcpu=niagara3:%{!mv8plus:-Av9" AS_NIAGARA3_FLAG "}} \ -%{mcpu=niagara4:%{!mv8plus:-Av9" AS_NIAGARA3_FLAG "}} \ +%{mcpu=niagara4:%{!mv8plus:" AS_NIAGARA4_FLAG "}} \ %{!mcpu*:%(asm_cpu_default)} \ " @@ -1746,6 +1747,12 @@ extern int sparc_indent_opcode; #define AS_NIAGARA3_FLAG "b" #endif +#ifdef HAVE_AS_SPARC4 +#define AS_NIAGARA4_FLAG "-xarch=sparc4" +#else +#define AS_NIAGARA4_FLAG "-Av9" AS_NIAGARA3_FLAG +#endif + /* We use gcc _mcount for profiling. */ #define NO_PROFILE_COUNTERS 0 Index: config/sparc/sol2.h =================================================================== --- config/sparc/sol2.h (revision 193416) +++ config/sparc/sol2.h (working copy) @@ -54,19 +54,56 @@ along with GCC; see the file COPYING3. /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */ -/* This is here rather than in sparc.h because it's not known what - other assemblers will accept. */ +/* If the assembler supports -xarch=sparc4, we switch to the explicit + word size selection mechanism available both in GNU as and Sun as, + for the Niagara4 and above configurations. */ +#ifdef HAVE_AS_SPARC4 + +#define AS_SPARC32_FLAG "" +#define AS_SPARC64_FLAG "" #ifndef USE_GAS -#define AS_SPARC64_FLAG "-xarch=v9" -#else -#define AS_SPARC64_FLAG "-TSO -64 -Av9" +#undef ASM_ARCH32_SPEC +#define ASM_ARCH32_SPEC "-m32" +#undef ASM_ARCH64_SPEC +#define ASM_ARCH64_SPEC "-m64" #endif +/* Both Sun as and GNU as understand -K PIC. */ +#undef ASM_SPEC +#define ASM_SPEC ASM_SPEC_BASE " %(asm_arch)" ASM_PIC_SPEC + +#else /* HAVE_AS_SPARC4 */ + +#define AS_SPARC32_FLAG "-xarch=v8plus" +#define AS_SPARC64_FLAG "-xarch=v9" + +#undef AS_NIAGARA4_FLAG +#define AS_NIAGARA4_FLAG AS_NIAGARA3_FLAG + +#undef ASM_ARCH32_SPEC +#define ASM_ARCH32_SPEC "" + +#undef ASM_ARCH64_SPEC +#define ASM_ARCH64_SPEC "" + +#undef ASM_ARCH_DEFAULT_SPEC +#define ASM_ARCH_DEFAULT_SPEC "" + +#undef ASM_ARCH_SPEC +#define ASM_ARCH_SPEC "" + +/* Both Sun as and GNU as understand -K PIC. */ +#undef ASM_SPEC +#define ASM_SPEC ASM_SPEC_BASE ASM_PIC_SPEC + +#endif /* HAVE_AS_SPARC4 */ + + #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "" #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9" #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 #undef CPP_CPU64_DEFAULT_SPEC @@ -83,7 +120,7 @@ along with GCC; see the file COPYING3. #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa" #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a" +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9a" #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif @@ -94,7 +131,7 @@ along with GCC; see the file COPYING3. #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb" #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b" +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9b" #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif @@ -105,7 +142,7 @@ along with GCC; see the file COPYING3. #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb" #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b" +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9b" #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif @@ -116,7 +153,7 @@ along with GCC; see the file COPYING3. #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb" #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b" +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9b" #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif @@ -127,7 +164,7 @@ along with GCC; see the file COPYING3. #undef ASM_CPU32_DEFAULT_SPEC #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus" AS_NIAGARA3_FLAG #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG AS_NIAGARA3_FLAG +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9" AS_NIAGARA3_FLAG #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif @@ -136,17 +173,13 @@ along with GCC; see the file COPYING3. #undef CPP_CPU64_DEFAULT_SPEC #define CPP_CPU64_DEFAULT_SPEC "" #undef ASM_CPU32_DEFAULT_SPEC -#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus" AS_NIAGARA3_FLAG +#define ASM_CPU32_DEFAULT_SPEC AS_SPARC32_FLAG AS_NIAGARA4_FLAG #undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG AS_NIAGARA3_FLAG +#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG AS_NIAGARA4_FLAG #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC #endif -/* Both Sun as and GNU as understand -K PIC. */ -#undef ASM_SPEC -#define ASM_SPEC ASM_SPEC_BASE ASM_PIC_SPEC - #undef CPP_CPU_SPEC #define CPP_CPU_SPEC "\ %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \ @@ -235,29 +268,17 @@ extern const char *host_detect_local_cpu #undef ASM_CPU_SPEC #define ASM_CPU_SPEC "\ -%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \ -%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \ -%{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \ -%{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \ -%{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \ -%{mcpu=niagara3:" DEF_ARCH32_SPEC("-xarch=v8plus" AS_NIAGARA3_FLAG) DEF_ARCH64_SPEC(AS_SPARC64_FLAG AS_NIAGARA3_FLAG) "} \ -%{mcpu=niagara4:" DEF_ARCH32_SPEC("-xarch=v8plus" AS_NIAGARA3_FLAG) DEF_ARCH64_SPEC(AS_SPARC64_FLAG AS_NIAGARA3_FLAG) "} \ -%{!mcpu=niagara4:%{!mcpu=niagara3:%{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}}}} \ +%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC("-xarch=v9") "} \ +%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC("-xarch=v9a") "} \ +%{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC("-xarch=v9b") "} \ +%{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC("-xarch=v9b") "} \ +%{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC("-xarch=v9b") "} \ +%{mcpu=niagara3:" DEF_ARCH32_SPEC("-xarch=v8plus" AS_NIAGARA3_FLAG) DEF_ARCH64_SPEC("-xarch=v9" AS_NIAGARA3_FLAG) "} \ +%{mcpu=niagara4:" DEF_ARCH32_SPEC(AS_SPARC32_FLAG AS_NIAGARA4_FLAG) DEF_ARCH64_SPEC(AS_SPARC64_FLAG AS_NIAGARA4_FLAG) "} \ +%{!mcpu=niagara4:%{!mcpu=niagara3:%{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC("-xarch=v9") "}}}}}}}} \ %{!mcpu*:%(asm_cpu_default)} \ " -#undef ASM_ARCH32_SPEC -#define ASM_ARCH32_SPEC "" - -#undef ASM_ARCH64_SPEC -#define ASM_ARCH64_SPEC "" - -#undef ASM_ARCH_DEFAULT_SPEC -#define ASM_ARCH_DEFAULT_SPEC "" - -#undef ASM_ARCH_SPEC -#define ASM_ARCH_SPEC "" - #ifdef USE_GLD /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly follow the Solaris 2 ABI. Prefer them if present. */