From patchwork Thu Jul 6 06:37:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongyu Wang X-Patchwork-Id: 116523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2354737vqx; Wed, 5 Jul 2023 23:40:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHeb6yA4j3RT6/7mL1TUVRaLHV/KCX3+IDdpI/P04rfisfAh+adgv3ekDUFPOvksUUOQgcy X-Received: by 2002:a17:906:74db:b0:988:71c8:9f3a with SMTP id z27-20020a17090674db00b0098871c89f3amr1147211ejl.16.1688625621247; Wed, 05 Jul 2023 23:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688625621; cv=none; d=google.com; s=arc-20160816; b=ao9/Z+wGgCXkwq0hDFr3fGUrYwZy5813X68u5QW5Pufh/j4Kma7+440lpgQEnok+B4 yu1ilDDm8pp3cQoYXr9gZQQa7q53t1TidtN5ySl1AEr9RrCpbEpO6preZKaRR45LraLF 1SisVWQwFDCgpGqu1S07lg5gOE29rv4WAExpEE42zhe7qL8+0aMmCn+tWudJQkvC0Zg0 /J16D7MIuyLP3K2czrI0eNS9JyHE+kRf8K24cYxTpeSuwQGt+oMmdx/Uns+4QCcemwmb V1XBcIvzeYHe1U/jjPmWNlBSV33dDMUFjH1OcXCexAKgb1CO+r566WC3hVCmAozsKc6h /Bbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=vhrkWfHz6EzDu1fMHHLI59fR2phKbS48qoD8LdZgvOk=; fh=F41tnau+Wuvrks7WHUhk2ix3yzqHkDd3nW2nLEHlsBI=; b=Hy8ddQMIl+Iu2yuR8mVhNJnCcgC9SVBijyP8Bemz3NOeX9qi49rI/fiaegL8eXVaF7 Z+BHC4+zwHjKH1ZoWuOa3w+OjwKGKeGfiHGTMWnl/sb1GUIi4K08/vtDSk50Tsq0fZ6g 1ud4P/xDBPzIKFMlh8UGTVQAgvsVSjBSBZyH11IDdd0oQ2zmFMws3MSuhDgPWcqibBrP dtWWEKfBnRDxx64unwiGiQTQ5x3oun1VdHsPwIFaeKR7HrzyGv5OIyC3lJENtgruuhWv 95c8VJjDxQjgfo1UbEACKiY1JGkBczsqhg3ax/NCkcKiQQiwl1tcdWDDmdLaSq38D+Ey IFfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pR3Jos+1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l26-20020a170906415a00b0098718971f52si474008ejk.87.2023.07.05.23.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 23:40:21 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pR3Jos+1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 F086E3856954 for ; Thu, 6 Jul 2023 06:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F086E3856954 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688625620; bh=vhrkWfHz6EzDu1fMHHLI59fR2phKbS48qoD8LdZgvOk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=pR3Jos+1NdmIaNsLTkW2Z/+KEKSBzv81pGNu6rryVcI5ykeR2iDEyz4Ig26x8QBGC 5tYnhRJT5kTi+lVRFuKGrZjzSJqcTuMmqDXYOaOnPzyqT0lCSw+AwZ5eD+m8mIVcdS pgOg6WPjrXCjbR3TDO1SMmw8ZJHVpbJPVNnikF30= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by sourceware.org (Postfix) with ESMTPS id E7C5C3856972 for ; Thu, 6 Jul 2023 06:39:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E7C5C3856972 X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="394275041" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="394275041" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2023 23:39:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="784806441" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="784806441" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga008.fm.intel.com with ESMTP; 05 Jul 2023 23:39:13 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 9348710079CE; Thu, 6 Jul 2023 14:39:12 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: ubizjak@gmail.com, hongtao.liu@intel.com Subject: [PATCH] i386: Update document for inlining rules Date: Thu, 6 Jul 2023 14:37:12 +0800 Message-Id: <20230706063712.409891-1-hongyu.wang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_SOFTFAIL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongyu Wang via Gcc-patches From: Hongyu Wang Reply-To: Hongyu Wang Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770652299474158008?= X-GMAIL-MSGID: =?utf-8?q?1770652299474158008?= Hi, This is a follow-up patch for https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623525.html that updates document about x86 inlining rules. Ok for trunk? gcc/ChangeLog: * doc/extend.texi: Move x86 inlining rule to a new subsubsection and add description for inling of function with arch and tune attributes. --- gcc/doc/extend.texi | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index d1b018ee6d6..d701b4d1d41 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7243,11 +7243,6 @@ Prefer 256-bit vector width for instructions. Prefer 512-bit vector width for instructions. @end table -On the x86, the inliner does not inline a -function that has different target options than the caller, unless the -callee has a subset of the target options of the caller. For example -a function declared with @code{target("sse3")} can inline a function -with @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}. @end table @cindex @code{indirect_branch} function attribute, x86 @@ -7361,6 +7356,20 @@ counterpart to option @option{-mno-direct-extern-access}. @end table +@subsubsection Inlining rules +On the x86, the inliner does not inline a +function that has different target options than the caller, unless the +callee has a subset of the target options of the caller. For example +a function declared with @code{target("sse3")} can inline a function +with @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}. + +Besides the basic rule, when a function specifies +@code{target("arch=@var{ARCH}")} or @code{target("tune=@var{TUNE}")} +attribute, the inlining rule will be different. It allows inlining of +a function with default @option{-march=x86-64} and +@option{-mtune=generic} specified, or a function that has a subset +of ISA features and marked with always_inline. + @node Xstormy16 Function Attributes @subsection Xstormy16 Function Attributes