From patchwork Sat Jul 22 14:17:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 124326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp828982vqg; Sat, 22 Jul 2023 07:18:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlEg0p7UOxSFk6XIB9mIkXQizTEuiPOMGoppxlunf5reNsKHEjPerTrNlGHUkwgHPgVoRYIX X-Received: by 2002:a17:906:7784:b0:987:47b3:6e34 with SMTP id s4-20020a170906778400b0098747b36e34mr4396501ejm.67.1690035504041; Sat, 22 Jul 2023 07:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690035504; cv=none; d=google.com; s=arc-20160816; b=Fond4khQ/1rvV+NGWUkKb/iXU2YzxbI/OHqJVfKv2Eda7ZDP5sUYUXxDN0DKUdBHym rYgyYFSd9UOTYVSpt8bU++cQrTOiMfZGR+Mu609/Hyr3eZK9bvbx9+LdZU7bUOxrs2Ma ul3FrPXYRB1vZHO03sQnFtrVSJ4LAf0PPq/Z9cFaj640iLVcgfyAKHfAkWUax3MhXM0N YfnX70LhcaYPErtrRXAuckPSiUkTUHz1vhbctrHuCC+QflwU9dKIK/FTeGY0/HYbdQpL fRHdd34OF7TtfWn0nrmKyeR9J3dh/PJwE5cEwBc6GH/IHhjySTs1iL8v7ArMI9Dgptbb VUEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:thread-index :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=/hv0w8lIY730gJFJud2b0dp+nT8AkM0isLdTyDXDgI0=; fh=UAbSimdGpojL/e9wL4Po0hjwO3sT24dauJYSxjnq65Y=; b=0G3RbNUVUsXB8h+SBjJsRQ+WwkTBNpIUrJH7KWr3ntxnKR/Y9hfC0HWw+40v3xUFUN 1XtSpd+/zeHL20JRtVarG9tkBtNA5wo0dAKXWSJRvGyIF0OOdvdscOD7C9PIfWlt2xCd 050FMMYHEYqzeX7XHwsX7pKQSV2eBzWNUlQCCYYA9ahdWhnZ+aXSShhiB8LxaUvIusIp e/+P4oXRZdR9DH41w0PX4jxboFvOTwpJoseEt3F1MwCveI/Nlk3SIAt5rCA4apfEfX2o yV+xEKUWYwQhih4W65avnszrld72P1pgGTGcHra2UvYg+iYxlzVhteTyut4RrJncAgeg 0WrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b="BukG1C/W"; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id xa15-20020a170907b9cf00b009930e13beb8si3927945ejc.952.2023.07.22.07.18.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jul 2023 07:18:24 -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=fail header.i=@nextmovesoftware.com header.s=default header.b="BukG1C/W"; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DF4D3865C20 for ; Sat, 22 Jul 2023 14:18:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id C89AB385DC00 for ; Sat, 22 Jul 2023 14:17:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C89AB385DC00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/hv0w8lIY730gJFJud2b0dp+nT8AkM0isLdTyDXDgI0=; b=BukG1C/WVGF4pqEjqSma/1ZAGL bhEcdfL89FOB9b4GJVPKjI0CZx+U0xKgDptlg9Izd6VZBs8kAE5Bi3HaXOkSnuX9V3ks99X9KLjHs ln1XUUCC+enbBuF3sf+DfxWEzl9FZx8LwiYifbDrDIRatVTspWuRI1G+gdTBuuKpdzJoFH0TnA8/O la4HolgDUe8EqdlGiz7mLoXYEDafrqwhGgo9HRVaVgbSC5F4nlgOeKDu/9rATtEz6F/mA9yj6aGMm lS9f1KsChfL5cOWTA0+kRLMcZwQdq0Hk8cdJLqX50WbJEbXWo01PD/bFOe7g+HUtmi5d1Avy6GHSq T0T6Id7A==; Received: from [185.62.158.67] (port=60351 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qNDQU-0001ye-1h; Sat, 22 Jul 2023 10:17:42 -0400 From: "Roger Sayle" To: Cc: "'Uros Bizjak'" Subject: [x86 PATCH] Don't use insvti_{high, low}part with -O0 (for compile-time). Date: Sat, 22 Jul 2023 15:17:40 +0100 Message-ID: <00a201d9bca7$4739a220$d5ace660$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adm8prb4OloIIxw6QEupVpksz9o1fA== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772130668263162986 X-GMAIL-MSGID: 1772130668263162986 This patch attempts to help with PR rtl-optimization/110587, a regression of -O0 compile time for the pathological pr28071.c. My recent patch helps a bit, but hasn't returned -O0 compile-time to where it was before my ix86_expand_move changes. The obvious solution/workaround is to guard these new TImode parameter passing optimizations with "&& optimize", so they don't trigger when compiling with -O0. The very minor complication is that "&& optimize" alone leads to the regression of pr110533.c, where our improved TImode parameter passing fixes a wrong-code issue with naked functions, importantly, when compiling with -O0. This should explain the one line fix below "&& (optimize || ix86_function_naked (cfun))". I've an additional fix/tweak or two for this compile-time issue, but this change eliminates the part of the regression that I've caused. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Ok for mainline? 2023-07-22 Roger Sayle gcc/ChangeLog * config/i386/i386-expand.cc (ix86_expand_move): Disable the 64-bit insertions into TImode optimizations with -O0, unless the function has the "naked" attribute (for PR target/110533). Cheers, Roger diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 7e94447..cdef95e 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -544,6 +544,7 @@ ix86_expand_move (machine_mode mode, rtx operands[]) /* Special case inserting 64-bit values into a TImode register. */ if (TARGET_64BIT + && (optimize || ix86_function_naked (current_function_decl)) && (mode == DImode || mode == DFmode) && SUBREG_P (op0) && GET_MODE (SUBREG_REG (op0)) == TImode