From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 894643858D33 for ; Tue, 27 Jun 2023 05:50:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 894643858D33 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-x533.google.com with SMTP id 4fb4d7f45d1cf-51d5569e4d1so2895431a12.2 for ; Mon, 26 Jun 2023 22:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687845040; x=1690437040; 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=sfwSYjLJQcxM79gitA+aJDCvHuA0gWqLf/05OVch2Hs=; b=RTDlkZdCnwmPbfB9mdYHcuaxERhcWmTe2R72IEzeEP39iX03cQs4BR+YRqoZLj4yoY d1RKVzHWsTYtnkrB+ZLLsQ+Y+cpaQtS2N9fINZ7OcpiZ5mIIlB+zjCI5NT6xmFncgJVr u6m4WJMBqLJnl9OnAB0cyTKz26oMWI2kmHum9zpO+PXt9TffqjiFjHa+8vB8/dhRRNNA 7HjIeKdkGOWSv3NaQR8AJU9pWD7ceA+7yUf++R6Zlnt88/we1ynfFgTPXrVfxyLKslSx utuXrWWfq5G50r4SDcg3cd1PsbX7LT5spjhDhd5ECuZh6y7GaLNxE2lJAo1qkbVfIkEt swLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687845040; x=1690437040; 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=sfwSYjLJQcxM79gitA+aJDCvHuA0gWqLf/05OVch2Hs=; b=H1ZgFL7at0fLU75HTQ5wr5kW7in9P5XjYYovCus/l9RGlAoircw0sEBgJyFxdlFU93 0yr4D3vOfCPdBTZC9MVjKzMGA0LQMgRX65lhdXT2p5s1i4JGx8yN9H6U2zFMOx/Vy9U7 uOrjI0/swNXiikM98TsybBVp2k6gj8xGgjbAMBaWxUqAKWfgDk8Odr28HhX5FH/PnNjp a9IEF6t8iX8P+YDIKgfFGaCLnC0HFmdDBmURmVB9Coab5P4q0mAk3CWNp1UKeTm1mT17 gQZDaqfn53hJR6gdjOKnKS7AP8R9Bf6fAr8cFWVDnTyfOK252cSKS7s1ijwdtIhGGqvM 2KWQ== X-Gm-Message-State: AC+VfDwO2yj5+hCt6C49if/U/hYXxWtsUQmJU9ECl42so3CMHOeskeHo Wh9MTboOQAQHuw7fC8AX8Yh/X1MXvUOCPXrnDs4= X-Google-Smtp-Source: ACHHUZ5xbzmdMB5KzP2dUX9/D5Rx3R9XW/zAtwGq9GNVgNSEWaKWiAGeipU2oEJWQnpQaaM/yBIlpUbeYQnOB4McTXA= X-Received: by 2002:aa7:c254:0:b0:51d:9b58:bfd2 with SMTP id y20-20020aa7c254000000b0051d9b58bfd2mr2804329edo.36.1687845039994; Mon, 26 Jun 2023 22:50:39 -0700 (PDT) MIME-Version: 1.0 References: <20230626022913.32556-1-hongyu.wang@intel.com> In-Reply-To: From: Hongyu Wang Date: Tue, 27 Jun 2023 13:43:24 +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: Thanks, I'll backport it down to GCC10 after this passed all bootstrap/regt= est. 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 its > > tune to -mtune from command line so all target_clones will get same > > tuning flags which would affect the performance for each clone. Overrid= e > > tune with arch if tune was not explicitly specified to get proper tunin= g > > 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_tree= ): > > 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-opt= ions.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, t= ree 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 specified,= set > > + tune_string to NULL and later it will be overriden by arch_str= ing > > + 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, use = it. */ > > diff --git a/gcc/testsuite/gcc.target/i386/mvc17.c b/gcc/testsuite/gcc.= 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 > >