From patchwork Fri Mar 31 05:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 77529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp328218vqo; Thu, 30 Mar 2023 22:12:17 -0700 (PDT) X-Google-Smtp-Source: AKy350aCcwtcYSBx15Oa40/0LMFVSD+dJzhZc4ad7EMMLdtBTX6gx/6c1NIDOzQzMal7B9nv9JHQ X-Received: by 2002:aa7:cacd:0:b0:4fc:7201:6e4 with SMTP id l13-20020aa7cacd000000b004fc720106e4mr24739059edt.20.1680239537510; Thu, 30 Mar 2023 22:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680239537; cv=none; d=google.com; s=arc-20160816; b=PlbMZyZTdH9qjjfUufyeGdMGDZqQBXhQmoLF6INkuRMZ1eBZ4QCT61RB2By0YKaDTt LcPUH1x7elw5RuQrnP4oAvpamHUGxl8ceZPYsE6d2Yaqd/9MhTR9XafSHhOq4oxZyKGH XzvBx7+9LAwGceeJ/fxHIZX5SCMKFueCRCuS6M6Yizue6HCd92iK++h9m7jnmkjIlT8J yI2e1Z6/uRrzi95qXINqpjqOuNCGtfuVKacfIRYWYu1DJwLOBBRx4hHMlyPtnaQVNJpT vRXkYv6+GBT9JvoWL0z/OFRw4p0HYax5fOY0tNtO22mBdR+gmvCm27lax3oAbRGT6EdR 6ILQ== 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=Np6ZPiXFPFuvJkkJpkXXcPf6YXfpH6q9G5c79QMULYM=; b=OZPbvGkeJqTFHLISqgdXdXDLyhOMudOmxC8wqT+4VdOnKh1wyZAT9GQYsVKHKiDoYN bIMtCzfUODIWafgrudxiyJcZWmgnrN/2dKtQnEehxRU/AhxKVlhzQFh9K0eKTfoV7EEj TRB5V4mzKf47TGfkoOmJlLr3DRynHK31ja1ujrwGjGlTM28kUfdC97fT086zqqaNrTjY 0PhxenQMxVcD7MswdBLoaiiS86UaMkHMAKvUNSJgX/cZYvMOcSQMfHsgY0EOY7Ia8+o8 124uO17EbEQb0ZCVWbR/pisfEw6fN8Bwy9D17HOd/a1VpP213sv4ZjmKU+UCHB5C9cg5 QDGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nfq0LF1h; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r5-20020aa7c145000000b004fd2b0fa78esi1380925edp.393.2023.03.30.22.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 22:12:17 -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=nfq0LF1h; 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 29A193858D38 for ; Fri, 31 Mar 2023 05:12:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29A193858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680239536; bh=Np6ZPiXFPFuvJkkJpkXXcPf6YXfpH6q9G5c79QMULYM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nfq0LF1hlizySWhOQ9YGqiMQCs62sHo+q2rYNfBLuJKcH9NF7LtN3xNQl2VHeuMz4 MabukTN0I5ofGAmj50/QjjOT3KpTbOaic5ZYQHYRX1tM0R2CGkYRXaglRtzw2ZWs2n AhDm9cao/r4YwnMIKYjCj68/SsDuqHTH1m9INHEM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 68C6D3858D20 for ; Fri, 31 Mar 2023 05:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68C6D3858D20 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="406369138" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="406369138" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 22:11:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="635163358" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="635163358" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga003.jf.intel.com with ESMTP; 30 Mar 2023 22:11:30 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 5BEFE1005170; Fri, 31 Mar 2023 13:11:29 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com Subject: [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8. Date: Fri, 31 Mar 2023 13:11:29 +0800 Message-Id: <20230331051129.2691249-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.39.1.388.g2fc9e9ca3c MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: liuhongt via Gcc-patches From: liuhongt Reply-To: liuhongt 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?1761858853265986841?= X-GMAIL-MSGID: =?utf-8?q?1761858853265986841?= RA sometimes will use lowest the cost of the mode with all different regclasses w/o check if it's hard_regno_mode_ok. It's impossible to put modes whose size > 8 into MASK_REGS, ajdust the cost to avoid potential performance issue. Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk? gcc/ChangeLog: * config/i386/i386.cc (inline_memory_move_cost): Return 100 for MASK_REGS when MODE_SIZE > 8. --- gcc/config/i386/i386.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 2cc8e9548a9..2581b800a06 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -19847,9 +19847,12 @@ inline_memory_move_cost (machine_mode mode, enum reg_class regclass, int in) index = 1; break; /* DImode loads and stores assumed to cost the same as SImode. */ - default: + case 4: + case 8: index = 2; break; + default: + return 100; } if (in == 2)