From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103279 invoked by alias); 25 Sep 2015 14:02:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 103264 invoked by uid 89); 25 Sep 2015 14:02:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e06smtp05.uk.ibm.com Received: from e06smtp05.uk.ibm.com (HELO e06smtp05.uk.ibm.com) (195.75.94.101) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 25 Sep 2015 14:02:37 +0000 Received: from /spool/local by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 25 Sep 2015 15:02:34 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 25 Sep 2015 15:02:32 +0100 X-MailFrom: vogt@linux.vnet.ibm.com X-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4DBD317D8059 for ; Fri, 25 Sep 2015 15:04:25 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t8PE2Wdj32243744 for ; Fri, 25 Sep 2015 14:02:32 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t8PE2Vd3015212 for ; Fri, 25 Sep 2015 08:02:31 -0600 Received: from bl3ahm9f.de.ibm.com (sig-9-83-89-168.evts.uk.ibm.com [9.83.89.168]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t8PE2VNa015176; Fri, 25 Sep 2015 08:02:31 -0600 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1ZfTa2-0004X0-25; Fri, 25 Sep 2015 16:02:30 +0200 Date: Fri, 25 Sep 2015 14:16:00 -0000 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Andreas Krebbel , Ulrich Weigand Subject: [PATCH 2/2] s/390: Implement "target" attribute. Message-ID: <20150925140229.GC14892@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: gcc-patches@gcc.gnu.org, Andreas Krebbel , Ulrich Weigand References: <20150925135941.GA14892@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline In-Reply-To: <20150925135941.GA14892@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15092514-0021-0000-0000-00000432E696 X-SW-Source: 2015-09/txt/msg01960.txt.bz2 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1620 On Fri, Sep 25, 2015 at 02:59:41PM +0100, Dominik Vogt wrote: > The following set of two patches implements the function > __attribute__ ((target("..."))) and the corresponding #pragma GCC > target("...") on S/390. It comes with certain limitations: > > * It is not possible to change any options that affect the ABI or > the definition of target macros by using the attribute (vx, > htm, zarch and others). Some of them are still supported but > unable to change the definition of the corresponding target macros. > In these cases, the pragma has to be used. One reason for this > is that it is not possible to change the definition of the target > macros with the attribute, but the implementation of some features > relies on them. > > * Even with the pragma it is not possible to switch between zarch > and esa architecture because internal data typed would have to be > changed at Gcc run time. > > The second patch contains a long term change in the interface with > the assembler. Currently, the compiler wrapper passes the same > -march= and -mtune= options to the compiler and the assembler. > The patch makes this obsolete by emitting ".machine" and > ".machinemode" dirctives to the top of the assembly language file. > The old way ist still supported but may be removed once the > ".machine" feature is supported by all as versions in the field. > > The second patch depends on the first one, and both require the > (latest) change proposed in this thread: > https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01546.html Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=0002-ChangeLog Content-length: 523 gcc/ChangeLog * config/s390/s390.c (s390_asm_file_start): Implement hook function to emit .machine and .machinemode to the top of the assembler file. (TARGET_ASM_FILE_START): Provide target hook. (s390_asm_output_machine_for_arch): Protect with HAVE_AS_MACHINE_MACHINEMODE instead of S390_USE_TARGET_ATTRIBUTE. gcc/testsuite/ChangeLog * gcc.target/s390/asm-machine-1.c: Updated. * gcc.target/s390/asm-machine-2.c: Updated. * gcc.target/s390/asm-machine-3.c: Updated. * gcc.target/s390/asm-machine-4.c: Updated. --EuxKj2iCbKjpUGkD Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-S-390-Emit-.machine-and-.machinemode-at-start-of-ass.patch" Content-length: 6433 >From 43563dc64dc8574493d5361140dbff2fbd366a27 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 28 Aug 2015 10:39:10 +0100 Subject: [PATCH 2/2] S/390: Emit .machine and .machinemode at start of assembler files. --- gcc/config/s390/s390.c | 16 +++++++++++++++- gcc/testsuite/gcc.target/s390/asm-machine-1.c | 7 +++++-- gcc/testsuite/gcc.target/s390/asm-machine-2.c | 9 ++++++--- gcc/testsuite/gcc.target/s390/asm-machine-3.c | 9 ++++++--- gcc/testsuite/gcc.target/s390/asm-machine-4.c | 9 ++++++--- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index c40f1c5..2711301 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6723,7 +6723,7 @@ s390_function_num_hotpatch_hw (tree decl, /* Write the current .machine and .machinemode specification to the assembler file. */ -#if S390_USE_TARGET_ATTRIBUTE +#ifdef HAVE_AS_MACHINE_MACHINEMODE static void s390_asm_output_machine_for_arch (FILE *asm_out_file) { @@ -14363,6 +14363,15 @@ s390_vector_alignment (const_tree type) return MIN (64, tree_to_shwi (TYPE_SIZE (type))); } +#ifdef HAVE_AS_MACHINE_MACHINEMODE +/* Implement TARGET_ASM_FILE_START. */ +static void +s390_asm_file_start (void) +{ + s390_asm_output_machine_for_arch (asm_out_file); +} +#endif + /* Implement TARGET_ASM_FILE_END. */ static void s390_asm_file_end (void) @@ -14662,6 +14671,11 @@ s390_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, const_tree ty #undef TARGET_INVALID_BINARY_OP #define TARGET_INVALID_BINARY_OP s390_invalid_binary_op +#ifdef HAVE_AS_MACHINE_MACHINEMODE +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START s390_asm_file_start +#endif + #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END s390_asm_file_end diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-1.c b/gcc/testsuite/gcc.target/s390/asm-machine-1.c index a5326e1..430d923 100644 --- a/gcc/testsuite/gcc.target/s390/asm-machine-1.c +++ b/gcc/testsuite/gcc.target/s390/asm-machine-1.c @@ -3,7 +3,10 @@ /* { dg-require-effective-target target_attribute } */ /* { dg-options "-march=z13 -mzarch" } */ +/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */ + void foo(void) { } -/* { dg-final { scan-assembler-not "\t\.machine " } } */ -/* { dg-final { scan-assembler-not "\t\.machinemode " } } */ +/* { dg-final { scan-assembler-times "\t\.machine " 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode " 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-2.c b/gcc/testsuite/gcc.target/s390/asm-machine-2.c index 910438e..6817e2a 100644 --- a/gcc/testsuite/gcc.target/s390/asm-machine-2.c +++ b/gcc/testsuite/gcc.target/s390/asm-machine-2.c @@ -3,6 +3,9 @@ /* { dg-require-effective-target target_attribute } */ /* { dg-options "-march=z13 -mzarch" } */ +/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ + void foo(void) { } __attribute__ ((target("arch=z10"))) @@ -12,8 +15,8 @@ void bar(void) { } /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */ +/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */ diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-3.c b/gcc/testsuite/gcc.target/s390/asm-machine-3.c index b056b19..3ae57a8 100644 --- a/gcc/testsuite/gcc.target/s390/asm-machine-3.c +++ b/gcc/testsuite/gcc.target/s390/asm-machine-3.c @@ -3,6 +3,9 @@ /* { dg-require-effective-target target_attribute } */ /* { dg-options "-march=z13 -mzarch" } */ +/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ + void foo(void) { } #pragma GCC target("arch=z10") @@ -12,8 +15,8 @@ void bar(void) { } /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */ +/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */ diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-4.c b/gcc/testsuite/gcc.target/s390/asm-machine-4.c index af9ab1c..932bfe6 100644 --- a/gcc/testsuite/gcc.target/s390/asm-machine-4.c +++ b/gcc/testsuite/gcc.target/s390/asm-machine-4.c @@ -3,6 +3,9 @@ /* { dg-require-effective-target target_attribute } */ /* { dg-options "-march=z13 -mzarch" } */ +/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ + void foo(void) { } #pragma GCC target("arch=z196") @@ -13,8 +16,8 @@ void bar(void) { } /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */ /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */ -/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */ -/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */ +/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */ +/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */ -- 2.3.0 --EuxKj2iCbKjpUGkD--