From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 09D613858D28 for ; Mon, 17 Oct 2022 12:55:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 09D613858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29HCs4qj001054; Mon, 17 Oct 2022 12:55:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=m+xn+qd77HlwmWMHGClvNRbJ/B2n/MphOTGlGpB/cvA=; b=tfQe/7BNDiL33LLyk1KiU/JtsIx/uadeJLMFmrCw9nI9GR3DihgJs44btA6Ph0gwmikX PdxvMhhIyChKTMvi8VOlqnmE4UZBABDjTCa9jYeDMsVJHIbuxlkwNNUolvpRcfnnxXzn z66OT6UDBS0Kh7QhYWLWV+2SH/s041ynqvuvJ2KoZ1FBS+bkPs9QRGzTcKUGrZEib7fP 0wCMnu7zleRCxGK11pzQKl05T0gBAMAy7Edw87qBwOSUt+auupHx6KgotsrDTWmTBxnU +vcGrkxgb5JTv46N5gA3SwRkqxKw9aEdNdfnuPYmBYS5qMuZzhBwysYyn4cwDNaV7bj3 tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3k86g616cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Oct 2022 12:55:02 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29HCh0cZ024636; Mon, 17 Oct 2022 12:55:02 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3k86g616c4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Oct 2022 12:55:02 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29HCZMle005472; Mon, 17 Oct 2022 12:55:00 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma05fra.de.ibm.com with ESMTP id 3k7mg8t99j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Oct 2022 12:55:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29HCswBS41156870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Oct 2022 12:54:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28B754C052; Mon, 17 Oct 2022 12:54:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 611EE4C04A; Mon, 17 Oct 2022 12:54:56 +0000 (GMT) Received: from [9.200.39.63] (unknown [9.200.39.63]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Oct 2022 12:54:56 +0000 (GMT) Message-ID: <375880b9-64b2-dfba-adfe-76937440ebd0@linux.ibm.com> Date: Mon, 17 Oct 2022 20:54:54 +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 Subject: Re: [PATCH, rs6000] Tests of ARCH_PWR8 and -mno-vsx option. (1/2) Content-Language: en-US To: will schmidt Cc: Segher Boessenkool , David Edelsohn , Michael Meissner , GCC patches References: From: "Kewen.Lin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 88TPY2ngVt32QlsCXzBlL63frsD4rJVn X-Proofpoint-ORIG-GUID: FCqhzOjCcAP4SNqV3td2oCNTA3BcXecg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-17_09,2022-10-17_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 mlxlogscore=995 bulkscore=0 impostorscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210170072 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,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 List-Id: Hi Will, Some comments are inline. on 2022/9/20 00:05, will schmidt wrote: > [PATCH, rs6000] Tests of ARCH_PWR8 and -mno-vsx option. > > Hi, > > This adds an assortment of tests to exercise the -mno-vsx option and > confirm the impacts on the ARCH_PWR8 define. > > These are based on and inspired by PR 101865, which > reports that _ARCH_PWR8 is disabled when -mno-vsx > is passed on the commandline. > > There are a small number of failures introduced by these tests, > those are resolved with the changes in part 2. > > OK for trunk? > Thanks, > -Will > > > gcc/testsuite: > * gcc.target/powerpc/predefine_p7-novsx.c: New test. > * gcc.target/powerpc/predefine_p8-noaltivec-novsx.c: New test. > * gcc.target/powerpc/predefine_p8-novsx.c: New test. > * gcc.target/powerpc/predefine_p9-novsx.c: New test. > * gcc.target/powerpc/predefine_pragma_vsx.c: New test. > > > diff --git a/gcc/testsuite/gcc.target/powerpc/predefine_p7-novsx.c b/gcc/testsuite/gcc.target/powerpc/predefine_p7-novsx.c > new file mode 100644 > index 000000000000..e842025b4d3c > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/predefine_p7-novsx.c > @@ -0,0 +1,9 @@ > +/* { dg-do preprocess } */ > +/* Test whether the ARCH_PWR7 and ARCH_PWR8 defines gets set Nit: s/gets/get. > + * when we specify power7, plus options. > +/* This is a variation of the test at issue in GCC PR 101865 */ > +/* { dg-options "-dM -E -mdejagnu-cpu=power7 -mno-vsx" } */ > +/* { dg-final { scan-file predefine_p7-novsx.i "(^|\\n)#define _ARCH_PWR7 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p7-novsx.i "(^|\\n)#define _ARCH_PWR8 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p7-novsx.i "(^|\\n)#define __VSX__ 1($|\\n)" } } */ > +/* { dg-final { scan-file predefine_p7-novsx.i "(^|\\n)#define __ALTIVEC__ 1($|\\n)" } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/predefine_p8-noaltivec-novsx.c b/gcc/testsuite/gcc.target/powerpc/predefine_p8-noaltivec-novsx.c > new file mode 100644 > index 000000000000..c3b705ca3d48 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/predefine_p8-noaltivec-novsx.c > @@ -0,0 +1,7 @@ > +/* { dg-do preprocess } */ > +/* Test whether the ARCH_PWR8 define remains set after disabling both altivec and vsx. */ > +/* { dg-options "-dM -E -mdejagnu-cpu=power8 -mno-altivec -mno-vsx" } */ > +/* { dg-final { scan-file predefine_p8-noaltivec-novsx.i "(^|\\n)#define _ARCH_PWR8 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p8-noaltivec-novsx.i "(^|\\n)#define _ARCH_PWR9 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p8-noaltivec-novsx.i "(^|\\n)#define __VSX__ 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p8-noaltivec-novsx.i "(^|\\n)#define __ALTIVEC__ 1($|\\n)" } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/predefine_p8-novsx.c b/gcc/testsuite/gcc.target/powerpc/predefine_p8-novsx.c > new file mode 100644 > index 000000000000..8b6c69b20104 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/predefine_p8-novsx.c > @@ -0,0 +1,8 @@ > +/* { dg-do preprocess } */ > +/* Test whether the ARCH_PWR8 define remains set after disabling vsx. > + This also confirms __ALTIVEC__ remains set when VSX is disabled. */ > +/* This is the primary test at issue in GCC PR 101865 */ Nit: the last comment missing a period. > +/* { dg-options "-dM -E -mdejagnu-cpu=power8 -mno-vsx" } */ > +/* { dg-final { scan-file predefine_p8-novsx.i "(^|\\n)#define _ARCH_PWR8 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p8-novsx.i "(^|\\n)#define __VSX__ 1($|\\n)" } } */ > +/* { dg-final { scan-file predefine_p8-novsx.i "(^|\\n)#define __ALTIVEC__ 1($|\\n)" } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/predefine_p9-novsx.c b/gcc/testsuite/gcc.target/powerpc/predefine_p9-novsx.c > new file mode 100644 > index 000000000000..eef42c111663 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/predefine_p9-novsx.c > @@ -0,0 +1,10 @@ > +/* { dg-do preprocess } */ > +/* Test whether the ARCH_PWR8 define remains set after disabling vsx. > + This also confirms __ALTIVEC__ remains set when VSX is disabled. */ > +/* This is the primary test at issue in GCC PR 101865 */ Nit: it seems this part of comments were copied from the above case? better with "s/ARCH_PWR8 define/ARCH_PWR8 and ARCH_PWR9 defines/" and and removing the last sentence since power9 isn't the primary test? > +/* { dg-options "-dM -E -mdejagnu-cpu=power9 -mno-vsx" } */ > +/* {xfail *-*-*} */ > +/* { dg-final { scan-file predefine_p9-novsx.i "(^|\\n)#define _ARCH_PWR8 1($|\\n)" } } */ > +/* { dg-final { scan-file predefine_p9-novsx.i "(^|\\n)#define _ARCH_PWR9 1($|\\n)" } } */ > +/* { dg-final { scan-file-not predefine_p9-novsx.i "(^|\\n)#define __VSX__ 1($|\\n)" } } */ > +/* { dg-final { scan-file predefine_p9-novsx.i "(^|\\n)#define __ALTIVEC__ 1($|\\n)" } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/predefine_pragma_vsx.c b/gcc/testsuite/gcc.target/powerpc/predefine_pragma_vsx.c > new file mode 100644 > index 000000000000..b300600af999 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/predefine_pragma_vsx.c > @@ -0,0 +1,83 @@ > +/* { dg-do run } */ > +/* { dg-require-effective-target powerpc_p9vector_ok } */ I guess you meant to use "p8vector_ok"? Ideally we need a power8_hw here since we force to use -mdejagnu-cpu=power8 below, there could be some actual p8 insns generated, but as the functions are very very simple, I don't think it's possible. :) > +/* { dg-require-effective-target lp64 } */ Is there a particular reason to exclude 32 bit here? > +/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2" } */ > + > +/* Ensure that if we set a pragma gcc target for an > + older processor, we do not compile builtins that > + the older target does not support. */ > + Nit: The comments here seem inconsistent to the contents below, I guessed it's stale (you used bifs but switched to check variable values later.)? BR, Kewen > +#include > +#include > +#include > + > +volatile int power8_set; > +volatile int vsx_set; > + > +void reset_values() { > + vsx_set=0; > + power8_set=0; > +} > + > +void test_default() { > + reset_values(); > +#ifdef _ARCH_PWR8 > + power8_set=1; > +#endif > +#ifdef __VSX__ > + vsx_set=1; > +#endif > +} > + > +#pragma GCC target "no-vsx" > +void test_no_vsx() { > + reset_values(); > +#ifdef _ARCH_PWR8 > + power8_set=1; > +#endif > +#ifdef __VSX__ > + vsx_set=1; > +#endif > +} > + > +#pragma GCC reset_options > +void test_reset_options() { > + reset_values(); > +#ifdef _ARCH_PWR8 > + power8_set=1; > +#endif > +#ifdef __VSX__ > + vsx_set=1; > +#endif > +} > + > +int main (int argc, char *argv []) { > + test_default(); > + if (!power8_set) { > + printf("_ARCH_PWR8 is not set.\n"); > + abort(); > + } > + if (!vsx_set) { > + printf("__VSX__ is not set.\n"); > + abort(); > + } > + test_no_vsx(); > + if (!power8_set) { > + printf("_ARCH_PWR8 is not set.\n"); > + abort(); > + } > + if (vsx_set) { > + printf("__VSX__ is unexpectedly set.\n"); > + abort(); > + } > + test_reset_options(); > + if (!power8_set) { > + printf("_ARCH_PWR8 is not set.\n"); > + abort(); > + } > + if (!vsx_set) { > + printf("__VSX__ is not set.\n"); > + abort(); > + } > +} > + >