From patchwork Mon Jun 1 08:33:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Vogt X-Patchwork-Id: 478849 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 81569140E62 for ; Mon, 1 Jun 2015 18:33:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=VSUgFPGF; 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:message-id:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=TMMfgYqYTZVjr8xsq 9iytuunZh1nTCUtjb8HkVdqcCNG72cd88jSsUoLM81OwSmOGu+3Lgd8ezoqBe6xH 7t8Ots8XSbUf8sYSi78Tfp7sZPWChVdOThPokZ5Iqs7Vsu87fvTn7MyjgqgW2Q9U f4HO9PVNzO0XCyzPomJyQ4UJT8= 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:message-id:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=9N5rY2h4vshFDfToWwsddGl /ffg=; b=VSUgFPGF0Fyed0/V3c6TrnVKDicrFqCqfz43mHlzCpmTcgw2Je7F/ng RGq6gH0xNIQuAW/bZf5aEy/Cjgquz7zyF9EGjO7MffrOZfCI3ncCXyg8JfSHuDl5 mtlYqP9JIy4UczfJmYyTz/BVB7pGLnvEgS/Q/RykgoFGZ1knLicM= Received: (qmail 68583 invoked by alias); 1 Jun 2015 08:33:19 -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 68570 invoked by uid 89); 1 Jun 2015 08:33:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 01 Jun 2015 08:33:08 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Jun 2015 09:33:04 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 1 Jun 2015 09:33:01 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 00F1F17D8056 for ; Mon, 1 Jun 2015 09:33:59 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t518X1Us24444990 for ; Mon, 1 Jun 2015 08:33:01 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t518X1Yo002484 for ; Mon, 1 Jun 2015 02:33:01 -0600 Received: from bl3ahm9f.de.ibm.com (dyn-9-152-212-154.boeblingen.de.ibm.com [9.152.212.154]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t518X16X002459; Mon, 1 Jun 2015 02:33:01 -0600 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1YzL9Y-0001jt-GO; Mon, 01 Jun 2015 10:33:00 +0200 Date: Mon, 1 Jun 2015 09:33:00 +0100 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Andreas Krebbel Subject: Re: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch Message-ID: <20150601083300.GA6312@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: gcc-patches@gcc.gnu.org, Andreas Krebbel References: <20150529105700.GA14508@linux.vnet.ibm.com> <20150529112848.GX10247@tucnak.redhat.com> <20150529141434.GA10037@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150529141434.GA10037@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: 15060108-0041-0000-0000-0000049E853F Backports of the patch for 5.1, 4.9 and 4.8 are attached to this message. The ChangeLog is the same as for upstream. (See https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02791.html ). Ciao Dominik ^_^ ^_^ From 3f112c572450f70c82e653989ef74c723e44c680 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 22 May 2015 09:03:26 +0100 Subject: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch=. --- gcc/config/s390/s390.c | 28 +++++++++++++++++----------- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 3 +-- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-20.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-22.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-23.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-24.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-25.c | 9 ++++----- gcc/testsuite/gcc.target/s390/hotpatch-26.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/s390/hotpatch-27.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/s390/hotpatch-28.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 4 ++-- gcc/testsuite/gcc.target/s390/s390.exp | 13 +++++++++++-- 30 files changed, 120 insertions(+), 55 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-26.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-27.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-28.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index a6b6a83..7452115 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -11267,31 +11267,37 @@ s390_reorg (void) /* Insert NOPs for hotpatching. */ for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - { - if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG) - break; - } - gcc_assert (insn); - /* Output a series of NOPs after the NOTE_INSN_FUNCTION_BEG. */ - while (hw_after > 0) + /* Emit NOPs + 1. inside the area covered by debug information to allow setting + breakpoints at the NOPs, + 2. before any insn which results in an asm instruction, + 3. before in-function labels to avoid jumping to the NOPs, for + example as part of a loop, + 4. before any barrier in case the function is completely empty + (__builtin_unreachable ()) and has neither internal labels nor + active insns. + */ + if (active_insn_p (insn) || BARRIER_P (insn) || LABEL_P (insn)) + break; + /* Output a series of NOPs before the first active insn. */ + while (insn && hw_after > 0) { if (hw_after >= 3 && TARGET_CPU_ZARCH) { - insn = emit_insn_after (gen_nop_6_byte (), insn); + emit_insn_before (gen_nop_6_byte (), insn); hw_after -= 3; } else if (hw_after >= 2) { - insn = emit_insn_after (gen_nop_4_byte (), insn); + emit_insn_before (gen_nop_4_byte (), insn); hw_after -= 2; } else { - insn = emit_insn_after (gen_nop_2_byte (), insn); + emit_insn_before (gen_nop_2_byte (), insn); hw_after -= 1; } } - gcc_assert (hw_after == 0); } } diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-1.c index b14fa90..55088b8 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-1.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-1.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-10.c index a990c4c..d2cb9a2 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-10.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-10.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=0,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-11.c index 6f8a52b..cabb9d26 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-11.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-11.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,0" } */ +/* { dg-options "-mzarch -mhotpatch=1,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-12.c index b73ca90..fc9adc3 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-12.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-12.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=999,0" } */ +/* { dg-options "-mzarch -mhotpatch=999,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-13.c index 150667a..b25fbd3 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-13.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-13.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -18,4 +18,3 @@ void hp1(void) /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ /* { dg-final { scan-assembler "alignment for hotpatch" } } */ -/* { dg-final { scan-assembler-times "\.align\t8" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-14.c b/gcc/testsuite/gcc.target/s390/hotpatch-14.c index c5f118c..c387d6b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-14.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-14.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-15.c b/gcc/testsuite/gcc.target/s390/hotpatch-15.c index ef0fb74..410106b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-15.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-15.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-16.c b/gcc/testsuite/gcc.target/s390/hotpatch-16.c index a34bf95..fa06fff 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-16.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-16.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=0,0" } */ #include @@ -13,7 +13,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-17.c b/gcc/testsuite/gcc.target/s390/hotpatch-17.c index 66ac725..3ef7d69 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-17.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-17.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ +/* { dg-options "-mzarch -mhotpatch=1,2" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-18.c b/gcc/testsuite/gcc.target/s390/hotpatch-18.c index 8b076a4..c93af7f 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-18.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-18.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ +/* { dg-options "-mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-19.c b/gcc/testsuite/gcc.target/s390/hotpatch-19.c index 6993c7e..c69b35e 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-19.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-19.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ +/* { dg-options "-mzarch -mhotpatch=1,2" } */ #include @@ -19,7 +19,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-2.c b/gcc/testsuite/gcc.target/s390/hotpatch-2.c index 67189f8..2a2665e 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-2.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-2.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1" } */ +/* { dg-options "-mzarch -mhotpatch=0,1" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(1 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(1 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nopr\t" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-20.c b/gcc/testsuite/gcc.target/s390/hotpatch-20.c index 09ef5ca..0a32a68 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-20.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-20.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-21.c b/gcc/testsuite/gcc.target/s390/hotpatch-21.c index e909990..f6e9099 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-21.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-21.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1" } */ +/* { dg-options "-mzarch -mhotpatch=0,1" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-22.c b/gcc/testsuite/gcc.target/s390/hotpatch-22.c index d89d779..21f7d7e 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-22.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-22.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=1024" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=1024" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-23.c b/gcc/testsuite/gcc.target/s390/hotpatch-23.c index 1e05d12..6e149cc 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-23.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-23.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=4096" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=4096" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-24.c b/gcc/testsuite/gcc.target/s390/hotpatch-24.c index fc64274..1e47591 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-24.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-24.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,1 -falign-functions=2048" } */ +/* { dg-options "-mzarch -mhotpatch=0,1 -falign-functions=2048" } */ #include diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-25.c b/gcc/testsuite/gcc.target/s390/hotpatch-25.c index e9257e3..e6cdbb6 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-25.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-25.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch" } */ +/* { dg-options "-mzarch" } */ typedef long (*fn_t)(void); @@ -25,9 +25,8 @@ fn_t outer(void) /* { dg-final { scan-assembler "pre-label.*(1 halfwords)" } } */ /* { dg-final { scan-assembler "pre-label.*(4 halfwords)" } } */ /* { dg-final { scan-assembler "pre-label.*(16 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(8 halfwords)" } } */ -/* { dg-final { scan-assembler "post-label.*(32 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nopr\t" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(8 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(32 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-times "alignment for hotpatch" 3 } } */ -/* { dg-final { scan-assembler-times "\.align\t8" 6 } } */ /* { dg-final { scan-assembler "nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr.*\n.*nopr" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-26.c b/gcc/testsuite/gcc.target/s390/hotpatch-26.c new file mode 100644 index 0000000..eb95c26 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-26.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +__attribute__ ((noreturn)) void hp1(void) +{ + __builtin_unreachable (); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-27.c b/gcc/testsuite/gcc.target/s390/hotpatch-27.c new file mode 100644 index 0000000..cdbd4ca --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-27.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +__attribute__ ((noreturn)) void hp3(void) +{ + __builtin_unreachable (); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-28.c b/gcc/testsuite/gcc.target/s390/hotpatch-28.c new file mode 100644 index 0000000..9922daa --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-28.c @@ -0,0 +1,18 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +void hp1 (volatile unsigned int *i) +{ + for (;;) + (*i)++; +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler "pre-label NOPs" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ +/* { dg-final { scan-assembler "alignment for hotpatch" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-3.c b/gcc/testsuite/gcc.target/s390/hotpatch-3.c index ec4a978..6718591 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-3.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-3.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,2" } */ +/* { dg-options "-mzarch -mhotpatch=0,2" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(2 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(2 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-4.c b/gcc/testsuite/gcc.target/s390/hotpatch-4.c index d55e71d..b770d4b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-4.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-4.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,3" } */ +/* { dg-options "-mzarch -mhotpatch=0,3" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(3 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(3 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-5.c b/gcc/testsuite/gcc.target/s390/hotpatch-5.c index f77d83a..f1dcd89 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-5.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-5.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,4" } */ +/* { dg-options "-mzarch -mhotpatch=0,4" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(4 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(4 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-6.c b/gcc/testsuite/gcc.target/s390/hotpatch-6.c index 330cf5d..6203a72b 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-6.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-6.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,5" } */ +/* { dg-options "-mzarch -mhotpatch=0,5" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(5 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(5 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-7.c b/gcc/testsuite/gcc.target/s390/hotpatch-7.c index 2f24e3cc..e201ae9 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-7.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-7.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0,6" } */ +/* { dg-options "-mzarch -mhotpatch=0,6" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(6 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(6 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-times "brcl\t0, 0" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-8.c index 7b266bd..1ea3160 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-8.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-8.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile { target { ! lp64 } } } */ -/* { dg-options "-O3 -mesa -march=g5 -mhotpatch=0,3" } */ +/* { dg-options "-mesa -march=g5 -mhotpatch=0,3" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(3 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(3 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-9.c b/gcc/testsuite/gcc.target/s390/hotpatch-9.c index c0ad319..e30f276 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-9.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-9.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile { target { ! lp64 } } } */ -/* { dg-options "-O3 -mesa -march=g5 -mhotpatch=0,4" } */ +/* { dg-options "-mesa -march=g5 -mhotpatch=0,4" } */ #include @@ -12,7 +12,7 @@ void hp1(void) /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ -/* { dg-final { scan-assembler "post-label.*(4 halfwords)" } } */ +/* { dg-final { scan-assembler "^\[^.\].*:\n.*post-label.*(4 halfwords).*\n\(\(.L.*:\n\)\|\(\[\[:space:\]\]*.cfi_.*\n\)\)*\[\[:space:\]\]*nop\t0" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 2 } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp index 141c0ee..a984064 100644 --- a/gcc/testsuite/gcc.target/s390/s390.exp +++ b/gcc/testsuite/gcc.target/s390/s390.exp @@ -46,9 +46,18 @@ if ![info exists DEFAULT_CFLAGS] then { # Initialize `dg'. dg-init +set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c + # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "" $DEFAULT_CFLAGS +dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \ + $hotpatch_tests]] "" $DEFAULT_CFLAGS + +# Additional hotpatch torture tests. +torture-init +set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3] +set-torture-options $HOTPATCH_TEST_OPTS +gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] $DEFAULT_CFLAGS +torture-finish # All done. dg-finish -- 2.3.0