From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 5A09A3858D35 for ; Wed, 28 Jun 2023 02:00:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A09A3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-51d9a925e9aso3463877a12.0 for ; Tue, 27 Jun 2023 19:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687917648; x=1690509648; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SfTH+WerRzAJfopQ9RQHvU+DeC8l2YM/z2EuWmEBVHc=; b=Gje+GLllgLlmkhUOsEwiV8sS0C1MKIT8cBsltyRXCfahmxV4wU/O3yQv0tQiMgnApo 1To4XjLMYz88RnPbQn2rP2DxMCoGHsYa+RMrdZYG6byrSxkDJrWw1Y3W1oPBQaRr5k4J QIphebDTjEzW5H1ZzLFj2dzXtUr1XWRZEwHuXPWZ+CSeZIsAR3FSYnjHZqXQMidys5tJ pvA7sK9z6FJWN4vVXHNOU94gD1+CiZ3CNOqDeX2vVLRjmADXX/Bl9ov6g3LDVod5ERo2 /q5z7kg0D3Lzrc7fxfWH642MsnPW7re+9SqLFEDq1bxR1AUooh+M5V46oyuGyIg2EPPt X8Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687917648; x=1690509648; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SfTH+WerRzAJfopQ9RQHvU+DeC8l2YM/z2EuWmEBVHc=; b=bkMJm8OzpYwpotU2LMWx2Z6utHewYrKu2EnYsVOLr3C+qby5cadQ+jHPD8zkLyrXQ1 3IiiW151MZT43jM4QUqNfe+bXYg+p74+7DBcBL6IH8JW4yfaK4QLZlXexEzEdLfGqjB1 2/8wDfP14Uejg3G2qgSmActF4bXHrUTd3Xw8GJLEaiS0e7YoJ+RUVWW0pE25oulEt0uB shUndlcT9kbvArWoOCkVmwM3TWipLbKp/IfRK7hF/9vsJIgejxoKjAgdn5T3q6j/mQnp hNWgjU6IKv4HZWqVASOaEZqCFdG1ODNkc4Sl2neBCTmE+wATbfKUJ1XAgGsSZcO87pVP OadA== X-Gm-Message-State: AC+VfDx0G3a3pnk/sir97Go+4c8Q32gpBAZeJ6AAz13s2vf6rUsCD5BS q94Y4K4uv4KDDWCHPv2NmX41XQU4AknEY0li9k5urEwLH4h94umw X-Google-Smtp-Source: ACHHUZ5wQDe3gi4pR+ZFQDXbrkjbBghh1vlwrR23gB9p/eCaYqI1Pt/mDMsndVBixv2nXZ8usJbAeLmUK5hp7mViNRg= X-Received: by 2002:a17:907:2be9:b0:991:b6f5:5f96 with SMTP id gv41-20020a1709072be900b00991b6f55f96mr5930727ejc.60.1687917648259; Tue, 27 Jun 2023 19:00:48 -0700 (PDT) MIME-Version: 1.0 References: <20230626022913.32556-1-hongyu.wang@intel.com> In-Reply-To: From: Hongyu Wang Date: Wed, 28 Jun 2023 09:53:32 +0800 Message-ID: Subject: Re: [PATCH] i386: Sync tune_string with arch_string for target attribute arch=* To: Uros Bizjak Cc: Hongyu Wang , gcc-patches@gcc.gnu.org, hongtao.liu@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: The testcase fails with --with-arch=3Dnative build on cascadelake, here is the patch to adjust it gcc/testsuite/ChangeLog: * gcc.target/i386/mvc17.c: Add -march=3Dx86-64 to dg-options. --- gcc/testsuite/gcc.target/i386/mvc17.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/i386/mvc17.c b/gcc/testsuite/gcc.target/i386/mvc17.c index 2c7cc2fdace..8b83c1aecb3 100644 --- a/gcc/testsuite/gcc.target/i386/mvc17.c +++ b/gcc/testsuite/gcc.target/i386/mvc17.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-ifunc "" } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -march=3Dx86-64" } */ /* { dg-final { scan-assembler-times "rep mov" 1 } } */ __attribute__((target_clones("default","arch=3Dicelake-server"))) --- Will push it as an obvious fix, also will apply to the pending backports. Hongyu Wang =E4=BA=8E2023=E5=B9=B46=E6=9C=8827=E6= =97=A5=E5=91=A8=E4=BA=8C 13:43=E5=86=99=E9=81=93=EF=BC=9A > > Thanks, I'll backport it down to GCC10 after this passed all bootstrap/re= gtest. > > Uros Bizjak via Gcc-patches =E4=BA=8E2023=E5=B9= =B46=E6=9C=8826=E6=97=A5=E5=91=A8=E4=B8=80 14:05=E5=86=99=E9=81=93=EF=BC=9A > > > > On Mon, Jun 26, 2023 at 4:31=E2=80=AFAM Hongyu Wang wrote: > > > > > > Hi, > > > > > > For function with target attribute arch=3D*, current logic will set i= ts > > > tune to -mtune from command line so all target_clones will get same > > > tuning flags which would affect the performance for each clone. Overr= ide > > > tune with arch if tune was not explicitly specified to get proper tun= ing > > > flags for target_clones. > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,} > > > > > > Ok for trunk and backport to active release branches? > > > > > > gcc/ChangeLog: > > > > > > * config/i386/i386-options.cc (ix86_valid_target_attribute_tr= ee): > > > Override tune_string with arch_string if tune_string is not > > > explicitly specified. > > > > > > gcc/testsuite/ChangeLog: > > > > > > * gcc.target/i386/mvc17.c: New test. > > > > LGTM. > > > > Thanks, > > Uros. > > > > > --- > > > gcc/config/i386/i386-options.cc | 6 +++++- > > > gcc/testsuite/gcc.target/i386/mvc17.c | 11 +++++++++++ > > > 2 files changed, 16 insertions(+), 1 deletion(-) > > > create mode 100644 gcc/testsuite/gcc.target/i386/mvc17.c > > > > > > diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-o= ptions.cc > > > index 2cb0bddcd35..7f593cebe76 100644 > > > --- a/gcc/config/i386/i386-options.cc > > > +++ b/gcc/config/i386/i386-options.cc > > > @@ -1400,7 +1400,11 @@ ix86_valid_target_attribute_tree (tree fndecl,= tree args, > > > if (option_strings[IX86_FUNCTION_SPECIFIC_TUNE]) > > > opts->x_ix86_tune_string > > > =3D ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_TUNE]= ); > > > - else if (orig_tune_defaulted) > > > + /* If we have explicit arch string and no tune string specifie= d, set > > > + tune_string to NULL and later it will be overriden by arch_s= tring > > > + so target clones can get proper optimization. */ > > > + else if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH] > > > + || orig_tune_defaulted) > > > opts->x_ix86_tune_string =3D NULL; > > > > > > /* If fpmath=3D is not set, and we now have sse2 on 32-bit, us= e it. */ > > > diff --git a/gcc/testsuite/gcc.target/i386/mvc17.c b/gcc/testsuite/gc= c.target/i386/mvc17.c > > > new file mode 100644 > > > index 00000000000..2c7cc2fdace > > > --- /dev/null > > > +++ b/gcc/testsuite/gcc.target/i386/mvc17.c > > > @@ -0,0 +1,11 @@ > > > +/* { dg-do compile } */ > > > +/* { dg-require-ifunc "" } */ > > > +/* { dg-options "-O2" } */ > > > +/* { dg-final { scan-assembler-times "rep mov" 1 } } */ > > > + > > > +__attribute__((target_clones("default","arch=3Dicelake-server"))) > > > +void > > > +foo (char *a, char *b, int size) > > > +{ > > > + __builtin_memcpy (a, b, size & 0x7F); > > > +} > > > -- > > > 2.31.1 > > >