From patchwork Wed Nov 15 14:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 165392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2561387vqg; Wed, 15 Nov 2023 06:10:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6SAwqOU+4HnndPcvDO/rUlhvNYFtddQ72gBqGQPDw7iSilSByb9NtA7+svoOgG8aQwZki X-Received: by 2002:a05:620a:b14:b0:775:8ed7:887 with SMTP id t20-20020a05620a0b1400b007758ed70887mr5665315qkg.26.1700057410851; Wed, 15 Nov 2023 06:10:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700057410; cv=pass; d=google.com; s=arc-20160816; b=nKuUZl8TUU0sRoGnI34LFN6kT8bor9/DJ3PvipEjChD151X97Q4wzC+L5zUYz59fde BvOxAsHUk7JdIQbZk2rpVOqCz30s8E9rozdFzmsMbP1S36g/iNG3Za7KlRILR4x64fL6 RN346RBwR/hmR/yIRiozplgscmJik6y7BMl1/XAeznwoeR4jKdPMFpCiyIcCV9XUozwc 9K1pJ2djPg8cd39AeAszR5lYSI0T4W0rrQu93EjX/7VdfprN1NhlMvibZwCxaTk1WhcQ bT7I8c7g1Fi4dAoiBULEbsj8STyRfyQpP1l+zKAnAmLS9Ci222o64UOrvbDrbL3De9c5 lA6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:to:content-language:subject :from:user-agent:mime-version:date:message-id:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=bcMRMQ/DHjZ3tgWJHMdTS5ihc/33lAgXjGB7MFjYYmE=; fh=XNn3asQvIblazGK92GBt13dVv+YmGV3pBS0JC29ZQco=; b=OdZeikleMJRHld9JIEDxRyOkUrXSJD5P3A60PDTMUPY0nN5OekOsir2h2ezndzmxVf e89KBmb/kasV4/Pl51kpoOVd+KBzY1ZDBkVw9TX8dLOt3olWBzEQ2FDxS0r/WVl9NH46 r7B+M6TPSuEGaetCYRvVGR1MYzTUASRlg76+X77e+46QGr0zd2tqOH72Z2iiPELy4gMM XIk7qJnDYXbmUJbWKdpXqEotq6ZYiIGftWK3nGm9l8gmKa5sfNSFIIcPSI2EK3aaCOhp VlPcKPRag+poQT57WSx2KDFsXW0Luuw+s5QcpW0nrSSHFlL8rxN4fD/Goa/LoS2u7DLb CTSQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ow17-20020a05620a821100b007759f94721asi8866035qkn.209.2023.11.15.06.10.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 06:10:10 -0800 (PST) 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; arc=pass (i=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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF70C385840E for ; Wed, 15 Nov 2023 14:10:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 293623858C29 for ; Wed, 15 Nov 2023 14:09:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 293623858C29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 293623858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.252 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700057385; cv=none; b=TwZlV09Rke3hntJiilxao4CskmiNCaoTKFGTK/9MK2aF6Dy+J7WbUv47gNYlMLZkG9Alj9IaW09Nla+B474s0T3BO5huLg4/kDumWl7+B7qZGRRzPWur9dm+vxuhBXMWsleQ4Z4jwBwAOi6hIx61yprQj9K8lhmEfujkUplwbOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700057385; c=relaxed/simple; bh=B+KkAqOIpsQCN6wnn4AUu5G2hWcXO1hQwDupzoSInIs=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=dQHUkNaLx2JhU1p8AKpU1ZwrbrIVGyI//vnFejd2AL1sOjgJ6elKtoLxiOzSj2Bf0thrjJO13KZgdK3ycbvzMNCqrc1LBPznvMGlGBPU1LAmFgWN83ipWZvGbXlGbnUbQhlx+qbXSytiCxmSGmsp+LQ5wGIWI+op2GgvL1tNYik= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 0B88I/boSt2+KxdcmplhGA== X-CSE-MsgGUID: 3EUD/JnfQuOx/xI+btQgsA== X-IronPort-AV: E=Sophos;i="6.03,305,1694764800"; d="scan'208";a="22817014" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 15 Nov 2023 06:09:41 -0800 IronPort-SDR: WetlnkDbf4HAwQ4z5stF1SdMM5TNjsmm7f7xfxP4iCK4ZM3q8y1GYIM8xm8DqB9v4ZCu1uoqcr oyBrHOvwr1z+wsMW9lmJaOrhTYRT5VgTCctxCIdV4VMZ9je/YuzJIkC0+PG7OKCbvGdV3JAvYG MwoCGd0hrdNfPtqkjvjujjt3riwJU29FdaiQIkif/4rMZH3r+++m6/2HKaf6K2u6F4IJejCJyu DEF3YmqCEUGpvBdsfWm4Fhg00cdLqOW3x1O96DtEcyf5cDOXOCU7fRy0VkGXz1YyVoCU/VrBbE V44= Message-ID: <8785e1cc-1e61-4487-80fa-4ef1d6220121@codesourcery.com> Date: Wed, 15 Nov 2023 14:09:36 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andrew Stubbs Subject: [committed] amdgcn: simplify secondary reload patterns Content-Language: en-GB To: "gcc-patches@gcc.gnu.org" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782639399684246194 X-GMAIL-MSGID: 1782639399684246194 This patch makes no functional changes, but cleans up the code a little to make way for my next patch. The confusung "reload_in" and "reload_out" define_expand were used solely for secondary reload and were nothing more than aliases for the "sgprbase" instructions. I've now learned that the constraints on these patterns were active (unusually for define_expand) so having them hide or duplicate the constraints from the real insns is pointless. Also, whatever restriction previously prevented use of the "@" feature, and led to creating the "CODE_FOR" macros, no longer exists (maybe moving to C++ fixed it?), so that can get cleaned up too. Andrew amdgcn: simplify secondary reload patterns Remove some unnecessary complexity; no functional change is intended, although LRA appears to use the constraints from the reload_in/out patterns, so it's probably an improvement for it to see the real sgprbase constraints. gcc/ChangeLog: * config/gcn/gcn-valu.md (mov_sgprbase): Add @ modifier. (reload_in): Delete. (reload_out): Delete. * config/gcn/gcn.cc (CODE_FOR): Delete. (get_code_for_##PREFIX##vN##SUFFIX): Delete. (CODE_FOR_OP): Delete. (get_code_for_##PREFIX): Delete. (gcn_secondary_reload): Replace "get_code_for" with "code_for". diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md index 8c441696ca4..8dc93e8c82e 100644 --- a/gcc/config/gcn/gcn-valu.md +++ b/gcc/config/gcn/gcn-valu.md @@ -641,7 +641,7 @@ (define_insn "mov_exec" ; vT += Sv ; flat_load v, vT -(define_insn "mov_sgprbase" +(define_insn "@mov_sgprbase" [(set (match_operand:V_1REG 0 "nonimmediate_operand") (unspec:V_1REG [(match_operand:V_1REG 1 "general_operand")] @@ -655,7 +655,7 @@ (define_insn "mov_sgprbase" [m,v ,&v;* ,12] # }) -(define_insn "mov_sgprbase" +(define_insn "@mov_sgprbase" [(set (match_operand:V_2REG 0 "nonimmediate_operand" "= v, v, m") (unspec:V_2REG [(match_operand:V_2REG 1 "general_operand" "vDB, m, v")] @@ -672,7 +672,7 @@ (define_insn "mov_sgprbase" [(set_attr "type" "vmult,*,*") (set_attr "length" "8,12,12")]) -(define_insn "mov_sgprbase" +(define_insn "@mov_sgprbase" [(set (match_operand:V_4REG 0 "nonimmediate_operand") (unspec:V_4REG [(match_operand:V_4REG 1 "general_operand")] @@ -685,31 +685,6 @@ (define_insn "mov_sgprbase" [m,v ,&v;* ,12] # }) -; reload_in was once a standard name, but here it's only referenced by -; gcn_secondary_reload. It allows a reload with a scratch register. - -(define_expand "reload_in" - [(set (match_operand:V_MOV 0 "register_operand" "= v") - (match_operand:V_MOV 1 "memory_operand" " m")) - (clobber (match_operand: 2 "register_operand" "=&v"))] - "" - { - emit_insn (gen_mov_sgprbase (operands[0], operands[1], operands[2])); - DONE; - }) - -; reload_out is similar to reload_in, above. - -(define_expand "reload_out" - [(set (match_operand:V_MOV 0 "memory_operand" "= m") - (match_operand:V_MOV 1 "register_operand" " v")) - (clobber (match_operand: 2 "register_operand" "=&v"))] - "" - { - emit_insn (gen_mov_sgprbase (operands[0], operands[1], operands[2])); - DONE; - }) - ; Expand scalar addresses into gather/scatter patterns (define_split diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index ac299259213..28065c50bfd 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -1388,64 +1388,6 @@ GEN_VN_NOEXEC (vec_series,si, A(rtx dest, rtx x, rtx c), A(dest, x, c)) #undef GET_VN_FN #undef A -/* Get icode for vector instructions without an optab. */ - -#define CODE_FOR(PREFIX, SUFFIX) \ -static int \ -get_code_for_##PREFIX##vN##SUFFIX (int nunits) \ -{ \ - switch (nunits) \ - { \ - case 2: return CODE_FOR_##PREFIX##v2##SUFFIX; \ - case 4: return CODE_FOR_##PREFIX##v4##SUFFIX; \ - case 8: return CODE_FOR_##PREFIX##v8##SUFFIX; \ - case 16: return CODE_FOR_##PREFIX##v16##SUFFIX; \ - case 32: return CODE_FOR_##PREFIX##v32##SUFFIX; \ - case 64: return CODE_FOR_##PREFIX##v64##SUFFIX; \ - } \ - \ - gcc_unreachable (); \ - return CODE_FOR_nothing; \ -} - -#define CODE_FOR_OP(PREFIX) \ - CODE_FOR (PREFIX, qi) \ - CODE_FOR (PREFIX, hi) \ - CODE_FOR (PREFIX, hf) \ - CODE_FOR (PREFIX, si) \ - CODE_FOR (PREFIX, sf) \ - CODE_FOR (PREFIX, di) \ - CODE_FOR (PREFIX, df) \ - CODE_FOR (PREFIX, ti) \ -static int \ -get_code_for_##PREFIX (machine_mode mode) \ -{ \ - int vf = GET_MODE_NUNITS (mode); \ - machine_mode smode = GET_MODE_INNER (mode); \ - \ - switch (smode) \ - { \ - case E_QImode: return get_code_for_##PREFIX##vNqi (vf); \ - case E_HImode: return get_code_for_##PREFIX##vNhi (vf); \ - case E_HFmode: return get_code_for_##PREFIX##vNhf (vf); \ - case E_SImode: return get_code_for_##PREFIX##vNsi (vf); \ - case E_SFmode: return get_code_for_##PREFIX##vNsf (vf); \ - case E_DImode: return get_code_for_##PREFIX##vNdi (vf); \ - case E_DFmode: return get_code_for_##PREFIX##vNdf (vf); \ - case E_TImode: return get_code_for_##PREFIX##vNti (vf); \ - default: break; \ - } \ - \ - gcc_unreachable (); \ - return CODE_FOR_nothing; \ -} - -CODE_FOR_OP (reload_in) -CODE_FOR_OP (reload_out) - -#undef CODE_FOR_OP -#undef CODE_FOR - /* Return true if OP is a PARALLEL of CONST_INTs that form a linear series with step STEP. */ @@ -2472,10 +2414,7 @@ gcn_secondary_reload (bool in_p, rtx x, reg_class_t rclass, if (GET_MODE_CLASS (reload_mode) == MODE_VECTOR_INT || GET_MODE_CLASS (reload_mode) == MODE_VECTOR_FLOAT) { - if (in_p) - sri->icode = get_code_for_reload_in (reload_mode); - else - sri->icode = get_code_for_reload_out (reload_mode); + sri->icode = code_for_mov_sgprbase (reload_mode); break; } /* Fallthrough. */