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: 1804150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=NE3QFtFP; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QxRjC1GSsz20ZC for ; Thu, 6 Jul 2023 16:39:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0AAA23856944 for ; Thu, 6 Jul 2023 06:39:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AAA23856944 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688625597; bh=vhrkWfHz6EzDu1fMHHLI59fR2phKbS48qoD8LdZgvOk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=NE3QFtFPj+KXfaltRN2AU8nAgIjfzidP0VqX3o1nYDCjGymMFoeWaukOsbV/E9N6+ oaoRMKZDnlePFI3DHFiduypGgVCRAiBOhfI3hxljC+zLlcqN1W6Sl70gVmKrOCSblw Vc7S6zM0qpvq+gsbYaLQ16lIwNgdOWZKptVAY6Ao= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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