From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by sourceware.org (Postfix) with ESMTPS id CC89B3858D20 for ; Mon, 26 Jun 2023 06:04:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC89B3858D20 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-qk1-x732.google.com with SMTP id af79cd13be357-765a169001eso79171585a.3 for ; Sun, 25 Jun 2023 23:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687759481; x=1690351481; 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=NFEBnm7AMwPOJjYKDCwccS+VVhkN/qG4Ree1jMni1yM=; b=bzBC6yVAfMZ9lvkTnTGBPrv2cWZjnbqS3gu6Izc8At6PGEpCpAOIMuP8dErBIf1yvG kBGxesFghlpU5bh5quJhYIEPYUioYwKKs0mv8DVVZR7vJESHdLszKCDAc6qxXj1xC1kT +MF6wrPUv2OC1K4z6KQll0F3LOXseOcrP6Okd0Jxfh/k0ZoLpe+jWhGf4FMtikZithey fn0imIBDjkDg5soeR7yBwiwJgWERIYPrnj8XLUGBUT4jQE8sG2ugGHIahS0Dn3timuQM DpZ93PX2xpHiyYLeUZgJHWGa6H+Vc/p1zbRORG0//9td+RXfrNqaIX1oJs9rRPxduq6r 4HSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687759481; x=1690351481; 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=NFEBnm7AMwPOJjYKDCwccS+VVhkN/qG4Ree1jMni1yM=; b=Be2/SQAwkaa3QMVkPzZjjAbI12eAqwxOUMnpNa3vuOQEiaCjrIRZMXQh80dYl8TfJs 0AFdxeGX7krQjgkFtOaRRL9LAf+AHVZq6bMT7CJXDuxbMPXJsA5jGq2MQcv+Cc/6ixjL TPbUhC+ZyPs3clUtRh1RyRIsOdzsVEVe5kRXJCdnyiggX/lTzg4q8gRCs8kNQAAcM/pv g+A9+GqFA7r/0NcPJZY/nYv/hobaym1apkmypxaGmNXP7uApXaOPqdWvNHvvs1EXwQTH 5iZHqo/EqonGAmGMFD52DdaH1u4CImYTvhVoeGIOB8M0Qshxis1H55B+11Y1Df0N9c59 JNAA== X-Gm-Message-State: AC+VfDyx+/A9Cq+8S3yFJrvovyt9d++VER8mEL+QxRuJMFEjyxtOF4rA cNyuzbVsXOe2vSe+755OsbOZ+gimuLnUg0nwRfM= X-Google-Smtp-Source: ACHHUZ5gEMFLDAfVuI4rQZXy+bTNmxg2cV6TM5lrM12G2pnqIWe07VDSo8Dw+To3s3B096CAP1ck8e+bqMPjPdvB/z8= X-Received: by 2002:ad4:5746:0:b0:621:700b:f9ef with SMTP id q6-20020ad45746000000b00621700bf9efmr25603620qvx.15.1687759481005; Sun, 25 Jun 2023 23:04:41 -0700 (PDT) MIME-Version: 1.0 References: <20230626022913.32556-1-hongyu.wang@intel.com> In-Reply-To: <20230626022913.32556-1-hongyu.wang@intel.com> From: Uros Bizjak Date: Mon, 26 Jun 2023 08:04:30 +0200 Message-ID: Subject: Re: [PATCH] i386: Sync tune_string with arch_string for target attribute arch=* To: Hongyu Wang Cc: 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=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: 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. Override > tune with arch if tune was not explicitly specified to get proper tuning > 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-optio= ns.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, tre= e 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, s= et > + tune_string to NULL and later it will be overriden by arch_strin= g > + 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.ta= rget/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 >