From patchwork Tue Dec 20 21:26:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Vogt X-Patchwork-Id: 707589 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tjrSk75nnz9t0w for ; Wed, 21 Dec 2016 08:26:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NyhYFrlI"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:reply-to:references:mime-version :content-type:in-reply-to:message-id; q=dns; s=default; b=HNRveL 1I4m97fBNTSlrOKC6vv4NXvU3UTIf4EBeOxvtjeGJzpNZoyN+CWBRG+dqjMXCkpD pYzepfKtq5XpkSytoGfwYxtbKvMk5wrv4Pn9ONsm75o96BZ6+ZOO/HFG8VWTma6I Myso7Rk2JcTMa475rWg48am8LkCOLsQYzrDRI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:reply-to:references:mime-version :content-type:in-reply-to:message-id; s=default; bh=sDjLZSP+GxeM TpP8w8QSwLD4Z9U=; b=NyhYFrlIYTEw24aIejzOIQOgLXpPi09W0+DxU5QS7KSl NYLkh/etED+y5cRQTIfZNV9tUq91gzMwzeFtTfepP9zVl8HUw2CcNKgdYL+C9bvG Lxrrlbr6Rqvt7O9Juos3vOQFzbHzcKSUbRLSNmPtNaWUjPF8EA2MnvlsoHF6ZD4= Received: (qmail 116888 invoked by alias); 20 Dec 2016 21:26:22 -0000 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 Received: (qmail 116877 invoked by uid 89); 20 Dec 2016 21:26:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=ciao, z10, Review, tam X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Dec 2016 21:26:19 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uBKLOSsm029486 for ; Tue, 20 Dec 2016 16:26:17 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 27f9bdbfc5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Dec 2016 16:26:17 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Dec 2016 21:26:14 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 20 Dec 2016 21:26:11 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D07231B08023; Tue, 20 Dec 2016 21:28:41 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uBKLQBXN8519952; Tue, 20 Dec 2016 21:26:11 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A4EDF42041; Tue, 20 Dec 2016 20:24:13 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10F744203F; Tue, 20 Dec 2016 20:24:13 +0000 (GMT) Received: from oc5510024614.ibm.com (unknown [9.145.166.33]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 20 Dec 2016 20:24:13 +0000 (GMT) Received: by oc5510024614.ibm.com (Postfix, from userid 500) id 00AA81AA26; Tue, 20 Dec 2016 22:26:13 +0100 (CET) Date: Tue, 20 Dec 2016 22:26:13 +0100 From: Dominik Vogt To: Mike Stump Cc: Jakub Jelinek , gcc-patches@gcc.gnu.org, Andreas Krebbel Subject: Re: [PATCH v4] Run tests only if the machine supports the instruction set. Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: vogt@linux.vnet.ibm.com, Mike Stump , Jakub Jelinek , gcc-patches@gcc.gnu.org, Andreas Krebbel References: <20161219142806.GA23636@linux.vnet.ibm.com> <20161219165040.GA15966@linux.vnet.ibm.com> <20161219170021.GW21933@tucnak> <20161220102247.GA5075@linux.vnet.ibm.com> <20161220103258.GF21933@tucnak> <20161220141031.GA1137@linux.vnet.ibm.com> <210F5588-09EA-421A-A9F3-CBDB2F985EDD@comcast.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <210F5588-09EA-421A-A9F3-CBDB2F985EDD@comcast.net> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16122021-0008-0000-0000-000003C2A62D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16122021-0009-0000-0000-00001BDAB965 Message-Id: <20161220212613.GA10846@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-20_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612200281 On Tue, Dec 20, 2016 at 11:57:52AM -0800, Mike Stump wrote: > On Dec 20, 2016, at 6:10 AM, Dominik Vogt wrote: > > Right, it gets called even more often than one would think, and > > even with empty torture_current_options. The attached new patch > > (v3) removes -Ox options and superflous whitespace and caches that > > between calls if it's not empty. There's another, permanent cache > > for calls without any flags. With proper ordering of the torture > > options, the test program is built only a couple of times. > > Seems fine to me, but most other cases use the postfix _hw. Any > reason not use use _hw (and not _runable) on these? If not, > could you please use _hw instead. No specific reason other than lack of imagination. "s390_hw" is a bit too generic in my eyes -> the new names are: v4: * Renamed "s390_runnable" to "s390_useable_hw". * Renamed "z900_runnable" to "s390_z900_hw", Renamed "z10_runnable" to "s390_z10_hw", etc. Ciao Dominik ^_^ ^_^ diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c index fcf7477..e841365 100644 --- a/gcc/config/s390/s390-c.c +++ b/gcc/config/s390/s390-c.c @@ -320,6 +320,8 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile, { s390_def_or_undef_macro (pfile, MASK_OPT_HTM, old_opts, opts, "__HTM__", "__HTM__"); + s390_def_or_undef_macro (pfile, MASK_OPT_VX, old_opts, opts, + "__S390_VX__", "__S390_VX__"); s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, "__VEC__=10301", "__VEC__"); s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, @@ -328,6 +330,21 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile, s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, "__bool=__attribute__((s390_vector_bool)) unsigned", "__bool"); + { + char macro_def[64]; + int arch_level; + gcc_assert (s390_arch != PROCESSOR_NATIVE); + arch_level = (int)s390_arch + 3; + if (s390_arch >= PROCESSOR_2094_Z9_EC) + /* Z9_EC has the same level as Z9_109. */ + arch_level--; + /* Review when a new arch is added and increase the value. */ + char dummy[23 - 2 * PROCESSOR_max] __attribute__((unused)); + sprintf (macro_def, "__S390_ARCH_LEVEL__=%d", arch_level); + cpp_undef (pfile, "__S390_ARCH_LEVEL__"); + cpp_define (pfile, macro_def); + } + if (!flag_iso) { s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, diff --git a/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c b/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c index ed78921..3f0677c 100644 --- a/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c +++ b/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c @@ -1,7 +1,8 @@ /* Machine description pattern tests. */ -/* { dg-do run { target { lp64 } } } */ +/* { dg-do compile { target { lp64 } } } */ /* { dg-options "-mzarch -save-temps -dP" } */ +/* { dg-do run { target { lp64 && s390_useable_hw } } } */ /* Skip test if -O0 is present on the command line: { dg-skip-if "" { *-*-* } { "-O0" } { "" } } @@ -13,26 +14,26 @@ __attribute__ ((noinline)) unsigned long andc_vv(unsigned long a, unsigned long b) { return ~b & a; } -/* { dg-final { scan-assembler ":15 .\* \{\\*anddi3\}" } } */ -/* { dg-final { scan-assembler ":15 .\* \{\\*xordi3\}" } } */ +/* { dg-final { scan-assembler ":16 .\* \{\\*anddi3\}" } } */ +/* { dg-final { scan-assembler ":16 .\* \{\\*xordi3\}" } } */ __attribute__ ((noinline)) unsigned long andc_pv(unsigned long *a, unsigned long b) { return ~b & *a; } -/* { dg-final { scan-assembler ":21 .\* \{\\*anddi3\}" } } */ -/* { dg-final { scan-assembler ":21 .\* \{\\*xordi3\}" } } */ +/* { dg-final { scan-assembler ":22 .\* \{\\*anddi3\}" } } */ +/* { dg-final { scan-assembler ":22 .\* \{\\*xordi3\}" } } */ __attribute__ ((noinline)) unsigned long andc_vp(unsigned long a, unsigned long *b) { return ~*b & a; } -/* { dg-final { scan-assembler ":27 .\* \{\\*anddi3\}" } } */ -/* { dg-final { scan-assembler ":27 .\* \{\\*xordi3\}" } } */ +/* { dg-final { scan-assembler ":28 .\* \{\\*anddi3\}" } } */ +/* { dg-final { scan-assembler ":28 .\* \{\\*xordi3\}" } } */ __attribute__ ((noinline)) unsigned long andc_pp(unsigned long *a, unsigned long *b) { return ~*b & *a; } -/* { dg-final { scan-assembler ":33 .\* \{\\*anddi3\}" } } */ -/* { dg-final { scan-assembler ":33 .\* \{\\*xordi3\}" } } */ +/* { dg-final { scan-assembler ":34 .\* \{\\*anddi3\}" } } */ +/* { dg-final { scan-assembler ":34 .\* \{\\*xordi3\}" } } */ /* { dg-final { scan-assembler-times "\tngr\?k\?\t" 4 } } */ /* { dg-final { scan-assembler-times "\txgr\?\t" 4 } } */ diff --git a/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c b/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c index d88da4d..89c8ea2 100644 --- a/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c +++ b/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c @@ -1,7 +1,8 @@ /* Machine description pattern tests. */ -/* { dg-do run } */ +/* { dg-do compile } */ /* { dg-options "-save-temps -dP" } */ +/* { dg-do run { target { s390_useable_hw } } } */ /* Skip test if -O0 is present on the command line: { dg-skip-if "" { *-*-* } { "-O0" } { "" } } @@ -13,26 +14,26 @@ __attribute__ ((noinline)) unsigned int andc_vv(unsigned int a, unsigned int b) { return ~b & a; } -/* { dg-final { scan-assembler ":15 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ -/* { dg-final { scan-assembler ":15 .\* \{\\*xorsi3\}" } } */ +/* { dg-final { scan-assembler ":16 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ +/* { dg-final { scan-assembler ":16 .\* \{\\*xorsi3\}" } } */ __attribute__ ((noinline)) unsigned int andc_pv(unsigned int *a, unsigned int b) { return ~b & *a; } -/* { dg-final { scan-assembler ":21 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ -/* { dg-final { scan-assembler ":21 .\* \{\\*xorsi3\}" } } */ +/* { dg-final { scan-assembler ":22 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ +/* { dg-final { scan-assembler ":22 .\* \{\\*xorsi3\}" } } */ __attribute__ ((noinline)) unsigned int andc_vp(unsigned int a, unsigned int *b) { return ~*b & a; } -/* { dg-final { scan-assembler ":27 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ -/* { dg-final { scan-assembler ":27 .\* \{\\*xorsi3\}" } } */ +/* { dg-final { scan-assembler ":28 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ +/* { dg-final { scan-assembler ":28 .\* \{\\*xorsi3\}" } } */ __attribute__ ((noinline)) unsigned int andc_pp(unsigned int *a, unsigned int *b) { return ~*b & *a; } -/* { dg-final { scan-assembler ":33 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ -/* { dg-final { scan-assembler ":33 .\* \{\\*xorsi3\}" } } */ +/* { dg-final { scan-assembler ":34 .\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ +/* { dg-final { scan-assembler ":34 .\* \{\\*xorsi3\}" } } */ /* { dg-final { scan-assembler-times "\tnr\?k\?\t" 4 } } */ /* { dg-final { scan-assembler-times "\txr\?k\?\t" 4 } } */ diff --git a/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c b/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c index ad442da..824ce39 100644 --- a/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c +++ b/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c @@ -7,8 +7,8 @@ always wins, even if the condition is false. If this test is run on hardware older than z10 with a buggy dejagnu release, the execution part will fail. - { dg-do assemble { target { ! z10_instructions } } } - { dg-do run { target { z10_instructions } } } + { dg-do assemble } + { dg-do run { target { s390_useable_hw } } } Skip test if -O0, -march=z900, -march=z9-109 or -march=z9-ec is present on the command line: diff --git a/gcc/testsuite/gcc.target/s390/md/setmem_long-1.c b/gcc/testsuite/gcc.target/s390/md/setmem_long-1.c index bd0c594..5fc54e2 100644 --- a/gcc/testsuite/gcc.target/s390/md/setmem_long-1.c +++ b/gcc/testsuite/gcc.target/s390/md/setmem_long-1.c @@ -1,7 +1,8 @@ /* Machine description pattern tests. */ -/* { dg-do run } */ +/* { dg-do compile } */ /* { dg-options "-mmvcle -dP -save-temps" } */ +/* { dg-do run { target { s390_useable_hw } } } */ __attribute__ ((noinline)) void test(char *p, char c, int len) @@ -16,8 +17,8 @@ void test2(char *p, int c, int len) } /* Check that the right patterns are used. */ -/* { dg-final { scan-assembler-times {c"?:9 .*{[*]setmem_long_?3?1?z?}} 1 } } */ -/* { dg-final { scan-assembler-times {c"?:15 .*{[*]setmem_long_and_?3?1?z?}} 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times {c"?:10 .*{[*]setmem_long_?3?1?z?}} 1 } } */ +/* { dg-final { scan-assembler-times {c"?:16 .*{[*]setmem_long_and_?3?1?z?}} 1 { xfail *-*-* } } } */ #define LEN 500 char buf[LEN + 2]; diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp index 450dcaf..d826dba 100644 --- a/gcc/testsuite/gcc.target/s390/s390.exp +++ b/gcc/testsuite/gcc.target/s390/s390.exp @@ -16,6 +16,9 @@ # GCC testsuite that uses the `dg.exp' driver. +global torture_current_flags +set torture_current_flags "" + # Exit immediately if this isn't a s390 target. if ![istarget s390*-*-*] then { return @@ -24,17 +27,6 @@ if ![istarget s390*-*-*] then { # Load support procs. load_lib gcc-dg.exp -# Return 1 if z10 instructions work. -proc check_effective_target_z10_instructions { } { - if { ![check_runtime s390_check_z10_instructions [subst { - int main (void) - { - asm ("rosbg %%r2,%%r2,0,0,0" : : ); - return 0; - } - }] "-march=z10 -mzarch" ] } { return 0 } else { return 1 } -} - # Return 1 if the the assembler understands .machine and .machinemode. The # target attribute needs that feature to work. proc check_effective_target_target_attribute { } { @@ -78,6 +70,138 @@ proc check_effective_target_vector { } { }] "-march=z13 -mzarch" ] } { return 0 } else { return 1 } } +global s390_cached_flags +set s390_cached_flags "" +global s390_cached_value +set s390_cached_value "" +global s390_cached_value_noflags +set s390_cached_value_noflags "" + +# Return 1 if a program using the full instruction set allowed by +# the compiler option can be executed. +proc check_effective_target_s390_useable_hw { } { + global torture_current_flags + global s390_cached_flags + global s390_cached_value + global s390_cached_value_noflags + + # Remove -Ox options and whitespace. + set flags [regsub -all {[-]O[0-9s]} "$torture_current_flags" ""] + set flags [regsub -all {[ \\t\\n]+} "$flags" " "] + set flags [regsub -all {(^ )|( $)} "$flags" ""] + if { "$s390_cached_flags" != "" && "$flags" == "$s390_cached_flags" } { + return $s390_cached_value + } + # Extra cache for (frequent) calls with empty torture_current_flags. + if { "$flags" == "" && $s390_cached_value_noflags != "" } { + return $s390_cached_value_noflags + } + if { ![check_runtime_nocache s390_check_useable_hw [subst { + int main (void) + { + asm (".machinemode zarch" : : ); + #if __S390_ARCH_LEVEL__ >= 11 + asm ("lcbb %%r2,0(%%r15),0" : : ); + #elif __S390_ARCH_LEVEL__ >= 10 + asm ("risbgn %%r2,%%r2,0,0,0" : : ); + #elif __S390_ARCH_LEVEL__ >= 9 + asm ("sgrk %%r2,%%r2,%%r2" : : ); + #elif __S390_ARCH_LEVEL__ >= 8 + asm ("rosbg %%r2,%%r2,0,0,0" : : ); + #elif __S390_ARCH_LEVEL__ >= 7 + asm ("nilf %%r2,0" : : ); + #elif __S390_ARCH_LEVEL__ >= 6 + asm ("lay %%r2,0(%%r15)" : : ); + #elif __S390_ARCH_LEVEL__ >= 5 + asm ("tam" : : ); + #endif + #ifdef __HTM__ + { + unsigned int nd; + asm ("etnd %0" : "=d" (nd)); + } + #endif + #ifdef __S390_VX__ + asm ("vzero %%v0" : : ); + #endif + return 0; + } + }] "$flags" ] } { set result 0 } else { set result 1 } + if { "$flags" == "" } { + set s390_cached_value_noflags "$result" + } else { + set s390_cached_flags "$flags" + set s390_cached_value "$result" + } + return $result +} + +# Return 1 if -march=... specific instructions are understood by +# the assembler and can be executed. +proc check_effective_target_s390_z900_hw { } { + if { ![check_runtime s390_check_s390_z900_hw [subst { + int main (void) + { + asm ("tam" : : ); + return 0; + } + }] "-march=z900 -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_z990_hw { } { + if { ![check_runtime s390_check_s390_z990_hw [subst { + int main (void) + { + asm ("lay %%r2,0(%%r15)" : : ); + return 0; + } + }] "-march=z990 -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_z9_ec_hw { } { + if { ![check_runtime s390_check_s390_z9_ec_hw [subst { + int main (void) + { + asm ("nilf %%r2,0" : : ); + return 0; + } + }] "-march=z9-ec -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_z10_hw { } { + if { ![check_runtime s390_check_s390_z10_hw [subst { + int main (void) + { + asm ("rosbg %%r2,%%r2,0,0,0" : : ); + return 0; + } + }] "-march=z10 -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_z196_hw { } { + if { ![check_runtime s390_check_s390_z196_hw [subst { + int main (void) + { + asm ("sgrk %%r2,%%r2,%%r2" : : ); + return 0; + } + }] "-march=z196 -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_zEC12_hw { } { + if { ![check_runtime s390_check_s390_zEC12_hw [subst { + int main (void) + { + asm ("risbgn %%r2,%%r2,0,0,0" : : ); + return 0; + } + }] "-march=zEC12 -m64 -mzarch" ] } { return 0 } else { return 1 } +} +proc check_effective_target_s390_z13_hw { } { + if { ![check_runtime s390_check_s390_z13_hw [subst { + int main (void) + { + asm ("lcbb %%r2,0(%%r15),0" : : ); + return 0; + } + }] "-march=z13 -m64 -mzarch" ] } { return 0 } else { return 1 } +} + # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS if ![info exists DEFAULT_CFLAGS] then { @@ -110,15 +234,27 @@ gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \ torture-finish # Additional md torture tests. +# (Note: Split into a separate torture test for each -march= option to improve +# cacheability.) +torture-init +set MD_TEST_OPTS [list \ + {-Os} {-Os -march=z900} \ + {-O0} {-O0 -march=z900} \ + {-O1} {-O1 -march=z900} \ + {-O2} {-O2 -march=z900} \ + {-O3} {-O3 -march=z900} ] +set-torture-options $MD_TEST_OPTS +gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" "$DEFAULT_CFLAGS" +torture-finish torture-init set MD_TEST_OPTS [list \ - {-Os -march=z900} {-Os -march=z13} \ - {-O0 -march=z900} {-O0 -march=z13} \ - {-O1 -march=z900} {-O1 -march=z13} \ - {-O2 -march=z900} {-O2 -march=z13} \ - {-O3 -march=z900} {-O3 -march=z13}] + {-Os -march=z13} \ + {-O0 -march=z13} \ + {-O1 -march=z13} \ + {-O2 -march=z13} \ + {-O3 -march=z13} ] set-torture-options $MD_TEST_OPTS -gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS +gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" "$DEFAULT_CFLAGS" torture-finish # All done. diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 6217272..d9681b1 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -533,6 +533,8 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } { set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags_t $option_list { + global torture_current_flags + set torture_current_flags "$flags_t" verbose "Testing $nshort, $flags $flags_t" 1 dg-test $test "$flags $flags_t" ${default-extra-flags} }