Message ID | 4847b51d-dde2-916b-27aa-8e63518d66d2@linux.ibm.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e252:0:0:0:0:0 with SMTP id bl18csp852514wrb; Wed, 20 Jul 2022 03:04:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbPAkx96Hms5V35Svcdaj3z6suPuNiFAqJ4AIeOdrE1m6XF4fYBLaysgQfwSwbs4iokMJR X-Received: by 2002:a05:6402:428c:b0:43b:cd8:b679 with SMTP id g12-20020a056402428c00b0043b0cd8b679mr48882358edc.404.1658311455789; Wed, 20 Jul 2022 03:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658311455; cv=none; d=google.com; s=arc-20160816; b=VzKS6d7EPq+JN/qWwJaDTIyZsgwUeIbOXZKCf1wqpY2CXBQtD2uvrrXsH0jEyzGLSR frwwg2P9jJnSyLR5+KGYzjBIjY5ohae65n57e3GzB7bi2t5qQSd6HDdjo/lPelhRFkxC 7wU3kV0QgDRjzjRNJX7GRKs1p2StzjqiBVqU7u9n/QmMpDChLPfy9O6GS7hpSALK5c64 ifm+Ws4sl4V1T9/HBt6dxBCYND+Fs5D/9LwxTwjFTvyxJFjLK1UmDGzGdIexzHEFiY3m Khj2Twc++5j2WExzG374eNtXty6MTsI0kqwR/7fAkn2twP43W8QJ4xzHU0ar1mOZSjK3 77qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=jLGmjZRpV/x1qiBrS8EDMJgbbKp0EHS0K6KNeGhUrM8=; b=r0ftvdYKqrb+M7Ijwi6IRK06wFskciOKLnTpUCzVcTYjBn8vzBO+zioQ7QUe0dBDRh tUiq7M7JEThIkgCIDyK4saEJPHODtrW16yBsdUE3RPAuGlQ0PUUaLPCh+Tbvu6/NtLse 7sU3mI0CCoRIGGHZe2Y3P4pJBZDa0/Isbbkwv4Nt8OF1PyfjAWuH8tCn4/8rSKJVsHQs 9zqeAs3SwoHSgK/cPpqKmQT2SFn25UfyVF0D+6LXexBcetK9O4LBzyuDk4TLjafQinT0 kqgdG+loNBLY4RiREIAt8oDZ+C+cyXr+EVS8w4uOaN8aFDiGyS/j1AuaBdgvUG6T6gEw LF5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="HrSgC+/o"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y6-20020a056402358600b0043ae1b74e96si23767319edc.381.2022.07.20.03.04.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 03:04:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="HrSgC+/o"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E2FA385740A for <ouuuleilei@gmail.com>; Wed, 20 Jul 2022 10:04:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E2FA385740A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658311454; bh=jLGmjZRpV/x1qiBrS8EDMJgbbKp0EHS0K6KNeGhUrM8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HrSgC+/os4MNJJ3cRA0dqheuvzBUcnN+jzdN5rkGx7IKpiwboq+dwMjFhRKBLeCRr aG+NMWMt8qo/jfogo+wz2Newr2hlw6urnY4tACKpbtNhPX4rb52TejBPOvT8DDxiaZ uonk3uHyWNHgXNJddjZhDQB23eWgmfxNCtQSOwmI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 5D8EE3858D37 for <gcc-patches@gcc.gnu.org>; Wed, 20 Jul 2022 10:03:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5D8EE3858D37 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26K9mZQx017561; Wed, 20 Jul 2022 10:03:28 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hefdc0d06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 10:03:28 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26K9ni3O025688; Wed, 20 Jul 2022 10:03:28 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hefdc0cy9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 10:03:27 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26K9M5JO029481; Wed, 20 Jul 2022 09:31:16 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3hbmy8m3qs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 09:31:16 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26K9TSTY22413748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 09:29:28 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4652AE053; Wed, 20 Jul 2022 09:31:13 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B242AE04D; Wed, 20 Jul 2022 09:31:12 +0000 (GMT) Received: from [9.197.246.191] (unknown [9.197.246.191]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 20 Jul 2022 09:31:11 +0000 (GMT) Message-ID: <4847b51d-dde2-916b-27aa-8e63518d66d2@linux.ibm.com> Date: Wed, 20 Jul 2022 17:31:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] rs6000/test: Update some cases with -mdejagnu-tune Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: n4nSbxxpvAJYftpBVdPM5yYj5s1VL1jV X-Proofpoint-GUID: RLGDTanNMXuCyxu_YHIBLGI2vqYCq01b X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-20_04,2022-07-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207200039 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: "Kewen.Lin via Gcc-patches" <gcc-patches@gcc.gnu.org> Reply-To: "Kewen.Lin" <linkw@linux.ibm.com> Cc: Peter Bergner <bergner@linux.ibm.com>, David Edelsohn <dje.gcc@gmail.com>, Segher Boessenkool <segher@kernel.crashing.org> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738865593351183043?= X-GMAIL-MSGID: =?utf-8?q?1738865593351183043?= |
Series |
rs6000/test: Update some cases with -mdejagnu-tune
|
|
Commit Message
Li, Pan2 via Gcc-patches
July 20, 2022, 9:31 a.m. UTC
Hi, As PR106345 shows, some test cases should be updated with -mdejagnu-tune, since their test points are sensitive to rs6000_tune, such as: group_ending_nop, loop align (ic), float conversion cost etc. This patch is to replace -mdejagnu-cpu with -mdejagnu-tune or append -mdejagnu-tune (keep the original -mdejagnu-cpu when it's required) accordingly. Tested on powerpc64-linux-gnu P7 and P8 and powerpc64le-linux-gnu P9 and P10, also with explicit p10 tune setting for configuration. I'll push this soon if no objections. BR, Kewen ----- PR testsuite/106345 gcc/testsuite/ChangeLog: * gcc.target/powerpc/lhs-1.c: Replace -mdejagnu-cpu with -mdejagnu-tune. * gcc.target/powerpc/loop_align.c: Likewise. * gcc.target/powerpc/lhs-2.c: Append -mdejagnu-tune. * gcc.target/powerpc/lhs-3.c: Likewise. * gcc.target/powerpc/compress-float-ppc-pic.c: Likewise. * gcc.target/powerpc/compress-float-ppc.c: Likewise. --- gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c | 2 +- gcc/testsuite/gcc.target/powerpc/compress-float-ppc.c | 2 +- gcc/testsuite/gcc.target/powerpc/lhs-1.c | 2 +- gcc/testsuite/gcc.target/powerpc/lhs-2.c | 2 +- gcc/testsuite/gcc.target/powerpc/lhs-3.c | 2 +- gcc/testsuite/gcc.target/powerpc/loop_align.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) -- 2.27.0
Comments
Hi! On Wed, Jul 20, 2022 at 05:31:11PM +0800, Kewen.Lin wrote: > As PR106345 shows, some test cases should be updated with > -mdejagnu-tune, since their test points are sensitive to > rs6000_tune, such as: group_ending_nop, loop align (ic), > float conversion cost etc. It does not make sense to require -mdejagnu-tune= if -mdejagnu-cpu= is already given? What is the failure case? > This patch is to replace -mdejagnu-cpu with -mdejagnu-tune > or append -mdejagnu-tune (keep the original -mdejagnu-cpu > when it's required) accordingly. It is *always* required. Testcases with -mtune= but unspecified -mcpu= make no sense. > --- a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c > +++ b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c > @@ -1,5 +1,5 @@ > /* { dg-do compile { target powerpc_fprs } } */ > -/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5" } */ > +/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5 -mdejagnu-tune=power5" } */ > /* { dg-require-effective-target fpic } */ This should only make a difference if you have -mtune= in your RUNTEST_FLAGS, and you shouldn't do silly things like that. I suspect you see it in other cases, and those are actual bugs then, that need actual fixing instead of sweeping under the carper. The testcase suggests this is with a compiler configured with --with-cpu= --with-tune=, which should just work, and -mcpu= should override both of those! Segher
Hi Segher, Thanks for the comments! on 2022/7/22 02:48, Segher Boessenkool wrote: > Hi! > > On Wed, Jul 20, 2022 at 05:31:11PM +0800, Kewen.Lin wrote: >> As PR106345 shows, some test cases should be updated with >> -mdejagnu-tune, since their test points are sensitive to >> rs6000_tune, such as: group_ending_nop, loop align (ic), >> float conversion cost etc. > > It does not make sense to require -mdejagnu-tune= if -mdejagnu-cpu= is > already given? What is the failure case? > I think cpu setting only sets tune setting when tune setting isn't explicitly provided as: if (rs6000_tune_index >= 0) tune_index = rs6000_tune_index; else if (cpu_index >= 0) rs6000_tune_index = tune_index = cpu_index; As PR106345 shows, GCC can use an explicit tune setting when it's configured, even if there is one "-mdejagnu-cpu=", it doesn't override the explicit given one, so we need one explicit "-mdejagnu-tune=". One failure example is gcc.target/powerpc/loop_align.c See function rs6000_loop_align: /* Implement LOOP_ALIGN. */ align_flags rs6000_loop_align (rtx label) { ... /* Align small loops to 32 bytes to fit in an icache sector, otherwise return default. */ if (ninsns > 4 && ninsns <= 8 && (rs6000_tune == PROCESSOR_POWER4 || rs6000_tune == PROCESSOR_POWER5 || rs6000_tune == PROCESSOR_POWER6 || rs6000_tune == PROCESSOR_POWER7 || rs6000_tune == PROCESSOR_POWER8)) return align_flags (5); else return align_loops; Although the test case has adopted option "-mdejagnu-cpu=power7", but the configured "--with-tune-64=power9" takes effect and make it return align_loops instead of align_flags (5). >> This patch is to replace -mdejagnu-cpu with -mdejagnu-tune >> or append -mdejagnu-tune (keep the original -mdejagnu-cpu >> when it's required) accordingly. > > It is *always* required. Testcases with -mtune= but unspecified -mcpu= > make no sense. > The loop_align.c testings made me think if we know the insn count for the loop on all cpus is in range (4,8] then the cpu setting doesn't matter. I think I get your point, it's risky to assume that even if it works for all existing cpus, will update with an explicit -mdejagnu-cpu here. >> --- a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c >> +++ b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c >> @@ -1,5 +1,5 @@ >> /* { dg-do compile { target powerpc_fprs } } */ >> -/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5" } */ >> +/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5 -mdejagnu-tune=power5" } */ >> /* { dg-require-effective-target fpic } */ > > This should only make a difference if you have -mtune= in your > RUNTEST_FLAGS, and you shouldn't do silly things like that. I suspect > you see it in other cases, and those are actual bugs then, that need > actual fixing instead of sweeping under the carper. > Unfortunately it's due to the explicit tune setting in configuration. > The testcase suggests this is with a compiler configured with > --with-cpu= --with-tune=, which should just work, and -mcpu= should > override both of those! > Unfortunately -mcpu= (-mdejagnu-cpu=) doesn't actually override here. BR, Kewen
On Fri, Jul 22, 2022 at 10:22:51AM +0800, Kewen.Lin wrote: > on 2022/7/22 02:48, Segher Boessenkool wrote: > > On Wed, Jul 20, 2022 at 05:31:11PM +0800, Kewen.Lin wrote: > >> As PR106345 shows, some test cases should be updated with > >> -mdejagnu-tune, since their test points are sensitive to > >> rs6000_tune, such as: group_ending_nop, loop align (ic), > >> float conversion cost etc. > > > > It does not make sense to require -mdejagnu-tune= if -mdejagnu-cpu= is > > already given? What is the failure case? > > > > I think cpu setting only sets tune setting when tune setting isn't > explicitly provided as: > > if (rs6000_tune_index >= 0) > tune_index = rs6000_tune_index; > else if (cpu_index >= 0) > rs6000_tune_index = tune_index = cpu_index; > > As PR106345 shows, GCC can use an explicit tune setting when it's > configured, even if there is one "-mdejagnu-cpu=", it doesn't > override the explicit given one, so we need one explicit > "-mdejagnu-tune=". And that is the problem. GCC's automatic setting is *not* an explicit option, not given by the user. --with-tune= should not result in adding an -mtune= option in the resulting compiler, it should not set command- line options. > Although the test case has adopted option "-mdejagnu-cpu=power7", but > the configured "--with-tune-64=power9" takes effect and make it > return align_loops instead of align_flags (5). And it should not do that. > >> This patch is to replace -mdejagnu-cpu with -mdejagnu-tune > >> or append -mdejagnu-tune (keep the original -mdejagnu-cpu > >> when it's required) accordingly. > > > > It is *always* required. Testcases with -mtune= but unspecified -mcpu= > > make no sense. > > The loop_align.c testings made me think if we know the insn count for > the loop on all cpus is in range (4,8] then the cpu setting doesn't matter. Sure, it probably works without -mcpu=, but it does not make sense :-) Only using -mtune= while not having -mcpu= serves no purpose in any "normal" use, so we shouldn't do that in the testsuite either. > > This should only make a difference if you have -mtune= in your > > RUNTEST_FLAGS, and you shouldn't do silly things like that. I suspect > > you see it in other cases, and those are actual bugs then, that need > > actual fixing instead of sweeping under the carper. > > Unfortunately it's due to the explicit tune setting in configuration. So that needs some actual fixes. Something in how --with-tune= works is suboptimal? > > The testcase suggests this is with a compiler configured with > > --with-cpu= --with-tune=, which should just work, and -mcpu= should > > override both of those! > > Unfortunately -mcpu= (-mdejagnu-cpu=) doesn't actually override here. ... or that. Segher
On 7/22/22 1:17 PM, Segher Boessenkool wrote: > On Fri, Jul 22, 2022 at 10:22:51AM +0800, Kewen.Lin wrote: >> on 2022/7/22 02:48, Segher Boessenkool wrote: >> As PR106345 shows, GCC can use an explicit tune setting when it's >> configured, even if there is one "-mdejagnu-cpu=", it doesn't >> override the explicit given one, so we need one explicit >> "-mdejagnu-tune=". > > And that is the problem. GCC's automatic setting is *not* an explicit > option, not given by the user. --with-tune= should not result in adding > an -mtune= option in the resulting compiler, it should not set command- > line options. > [snip] > And it should not do that. Currently, our rs6000.h has this: /* Only for use in the testsuite: -mdejagnu-cpu= simply overrides -mcpu=. With older versions of Dejagnu the command line arguments you set in RUNTESTFLAGS override those set in the testcases; with this option, the testcase will always win. Ditto for -mdejagnu-tune=. */ #define DRIVER_SELF_SPECS \ "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*}", \ "%{mdejagnu-tune=*: %<mtune=* -mtune=%*}", \ "%{mdejagnu-*: %<mdejagnu-*}", \ SUBTARGET_DRIVER_SELF_SPECS This means -mdejagnu-cpu= usage will only filter out -mcpu= usage. I guess it should also filter out all -mtune= usage as well. That way, we'll tune according to the -mdejagnu-cpu= option which is what we want. That was an oversight on my part when I added the code. :-( So I think the way the code above *should* work is: 1) Any -mdejagnu-cpu= usage should filter out all -mcpu= and -mtune= options. 2) Any -mdejagnu-tune= usage should filter all -mtune= options. It should not filter out any -mcpu= options. I believe that should fix the issue we're seeing. Peter
On 7/22/22 1:53 PM, Peter Bergner wrote: > So I think the way the code above *should* work is: > 1) Any -mdejagnu-cpu= usage should filter out all -mcpu= and -mtune= options. > 2) Any -mdejagnu-tune= usage should filter all -mtune= options. > It should not filter out any -mcpu= options. Like this: diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 3b8941a8658..26874943795 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -86,7 +86,7 @@ RUNTESTFLAGS override those set in the testcases; with this option, the testcase will always win. Ditto for -mdejagnu-tune=. */ #define DRIVER_SELF_SPECS \ - "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*}", \ + "%{mdejagnu-cpu=*: %<mcpu=* %<mtune=* -mcpu=%*}", \ "%{mdejagnu-tune=*: %<mtune=* -mtune=%*}", \ "%{mdejagnu-*: %<mdejagnu-*}", \ SUBTARGET_DRIVER_SELF_SPECS Kewen, can you see if the above patch fixes the issues you're seeing? Peter
Hi Peter and Segher, on 2022/7/23 03:28, Peter Bergner wrote: > On 7/22/22 1:53 PM, Peter Bergner wrote: >> So I think the way the code above *should* work is: >> 1) Any -mdejagnu-cpu= usage should filter out all -mcpu= and -mtune= options. >> 2) Any -mdejagnu-tune= usage should filter all -mtune= options. >> It should not filter out any -mcpu= options. > > Like this: > > diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h > index 3b8941a8658..26874943795 100644 > --- a/gcc/config/rs6000/rs6000.h > +++ b/gcc/config/rs6000/rs6000.h > @@ -86,7 +86,7 @@ > RUNTESTFLAGS override those set in the testcases; with this option, > the testcase will always win. Ditto for -mdejagnu-tune=. */ > #define DRIVER_SELF_SPECS \ > - "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*}", \ > + "%{mdejagnu-cpu=*: %<mcpu=* %<mtune=* -mcpu=%*}", \ > "%{mdejagnu-tune=*: %<mtune=* -mtune=%*}", \ > "%{mdejagnu-*: %<mdejagnu-*}", \ > SUBTARGET_DRIVER_SELF_SPECS > > > Kewen, can you see if the above patch fixes the issues you're seeing? > Thanks for the insightful comments and patch! I confirmed that this proposed patch can fix those found test issues. I adjusted the relevant comments and confirmed that it can be bootstrapped and regtested on powerpc64-linux-gnu P7 and P8 and powerpc64le-linux-gnu P9 and P10. Segher pre-approved it, I just committed it as r13-1818 as attached. Will backport it to release branches in a week or so. Thanks again. BR, Kewen From 75d20d6c84c12bedd65a904e462f02f0b9eb3f77 Mon Sep 17 00:00:00 2001 From: Peter Bergner <bergner@linux.ibm.com> Date: Mon, 25 Jul 2022 00:51:44 -0500 Subject: [PATCH] rs6000: Adjust -mdejagnu-cpu to filter out -mtune [PR106345] As PR106345 shows, when configuring compiler with an explicit option --with-tune=<value>, it would cause some test cases to fail if their test points are sensitive to tune setting, such as: group_ending_nop, loop align etc. It doesn't help that even to specify one explicit -mcpu=. This patch is to adjust the behavior of -mdejagnu-cpu by filtering out all -mcpu= and -mtune= options, then test cases would use <cpu> as tune as the one specified by -mdejagnu-cpu. 2022-07-25 Peter Bergner <bergner@linux.ibm.com> Kewen Lin <linkw@linux.ibm.com> PR testsuite/106345 gcc/ChangeLog: * config/rs6000/rs6000.h (DRIVER_SELF_SPECS): Adjust -mdejagnu-cpu to filter out all -mtune options. --- gcc/config/rs6000/rs6000.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 7d04556304a..ad9bf0f7358 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -81,12 +81,15 @@ # define SUBTARGET_DRIVER_SELF_SPECS "" #endif -/* Only for use in the testsuite: -mdejagnu-cpu= simply overrides -mcpu=. +/* Only for use in the testsuite: -mdejagnu-cpu=<value> filters out all + -mcpu= as well as -mtune= options then simply adds -mcpu=<value>, + while -mdejagnu-tune=<value> filters out all -mtune= options then + simply adds -mtune=<value>. With older versions of Dejagnu the command line arguments you set in - RUNTESTFLAGS override those set in the testcases; with this option, - the testcase will always win. Ditto for -mdejagnu-tune=. */ + RUNTESTFLAGS override those set in the testcases; with these options, + the testcase will always win. */ #define DRIVER_SELF_SPECS \ - "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*}", \ + "%{mdejagnu-cpu=*: %<mcpu=* %<mtune=* -mcpu=%*}", \ "%{mdejagnu-tune=*: %<mtune=* -mtune=%*}", \ "%{mdejagnu-*: %<mdejagnu-*}", \ SUBTARGET_DRIVER_SELF_SPECS
diff --git a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c index 8961be51d2f..d14ccb433b9 100644 --- a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c +++ b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc_fprs } } */ -/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5" } */ +/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5 -mdejagnu-tune=power5" } */ /* { dg-require-effective-target fpic } */ double foo (double x) { diff --git a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc.c b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc.c index 650f559f347..d6f84e57ab9 100644 --- a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc.c +++ b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc.c @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc_fprs } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power5" } */ +/* { dg-options "-O2 -mdejagnu-cpu=power5 -mdejagnu-tune=power5" } */ double foo (double x) { return x + 1.75; diff --git a/gcc/testsuite/gcc.target/powerpc/lhs-1.c b/gcc/testsuite/gcc.target/powerpc/lhs-1.c index 4e13fd2fb70..bcb41abbe91 100644 --- a/gcc/testsuite/gcc.target/powerpc/lhs-1.c +++ b/gcc/testsuite/gcc.target/powerpc/lhs-1.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power5" } */ +/* { dg-options "-O2 -mdejagnu-tune=power5" } */ /* { dg-final { scan-assembler-times "nop" 3 } } */ /* Test generation of nops in load hit store situation. Make sure enough nop diff --git a/gcc/testsuite/gcc.target/powerpc/lhs-2.c b/gcc/testsuite/gcc.target/powerpc/lhs-2.c index d1b18b1591d..22aa0d8712f 100644 --- a/gcc/testsuite/gcc.target/powerpc/lhs-2.c +++ b/gcc/testsuite/gcc.target/powerpc/lhs-2.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power6 -msched-groups" } */ +/* { dg-options "-O2 -mdejagnu-cpu=power6 -mdejagnu-tune=power6 -msched-groups" } */ /* { dg-final { scan-assembler "ori 1,1,0" } } */ /* Test generation of group ending nop in load hit store situation. */ diff --git a/gcc/testsuite/gcc.target/powerpc/lhs-3.c b/gcc/testsuite/gcc.target/powerpc/lhs-3.c index 9d6bbcf69f7..d7b500092bb 100644 --- a/gcc/testsuite/gcc.target/powerpc/lhs-3.c +++ b/gcc/testsuite/gcc.target/powerpc/lhs-3.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power7" } */ +/* { dg-options "-O2 -mdejagnu-cpu=power7 -mdejagnu-tune=power7" } */ /* { dg-final { scan-assembler "ori 2,2,0" } } */ /* Test generation of group ending nop in load hit store situation. */ diff --git a/gcc/testsuite/gcc.target/powerpc/loop_align.c b/gcc/testsuite/gcc.target/powerpc/loop_align.c index ef67f77efed..36e3b4c98c3 100644 --- a/gcc/testsuite/gcc.target/powerpc/loop_align.c +++ b/gcc/testsuite/gcc.target/powerpc/loop_align.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* powerpc-ibm-aix* } } */ -/* { dg-options "-O2 -mdejagnu-cpu=power7 -falign-functions=16 -fno-unroll-loops" } */ +/* { dg-options "-O2 -mdejagnu-tune=power7 -falign-functions=16 -fno-unroll-loops" } */ /* { dg-final { scan-assembler ".p2align 5" } } */ void f(double *a, double *b, double *c, unsigned long n) {