From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nh604-vm3.bullet.mail.ssk.yahoo.co.jp (nh604-vm3.bullet.mail.ssk.yahoo.co.jp [182.22.90.60]) by sourceware.org (Postfix) with SMTP id 50C83386DC7F for ; Tue, 14 Jun 2022 03:54:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50C83386DC7F Received: from [182.22.66.105] by nh604.bullet.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:39 -0000 Received: from [182.22.91.132] by t603.bullet.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:39 -0000 Received: from [127.0.0.1] by omp605.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:39 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 645429.8527.bm@omp605.mail.ssk.yahoo.co.jp Received: (qmail 87768 invoked by alias); 14 Jun 2022 03:54:39 -0000 Received: from unknown (HELO ?192.168.2.3?) (175.177.45.163 with ) by smtp6002.mail.ssk.ynwp.yahoo.co.jp with SMTP; 14 Jun 2022 03:54:39 -0000 X-YMail-JAS: V78HjdMVM1kzYde6QMW_fbkN_xKwXIKGKQ8dWVm.iwJRA69uM6MatPp2f_3y281xsiwCVXT8OImGJ_8izH9Tt5EDasUBZcHm5YbSjJNTZ6WulZHa36dffoVp7_axpHLCoDvxQo2xkg-- X-Apparently-From: X-YMail-OSG: l8LAZPwVM1nqRVi6PcRBSjNvMTam2qbWjuSzQeu1U__PiAE t7VlQ0zE0B4gMyq6izl8BTTduQcf135AYwCHVbaO_2EI6OjrBFjWsieC2vHv jhBinrEC.wICdU.0rUJw0rnoWcF9ySTXNprX7rXHoZdkEvsaqbqro_ed9pk0 3GEaJf8_wQuQZkGFZjnlE5ZHlDqi2GJomA3ZXaue8PCKFJer_SzlgRi4eF1y PQZa805KwqeJJAZNqRICS9EH7tukmjVjIpesLPC8ECn8ZXAR5xnyIgx3Ghs4 chdwWANEZqw0jk5IP_9EMl0OyBp5EyGXEq3bb9MzqD.fBwLQ_AfrFKX8ZyhY VNhuB0DZDxq59.8Y9POsWw_QITRgypKd6EKnTqu4FsguhE7ikvxraqzBkanL 1s1rwwomNRZKc5LvyOYkaKqgmRiJbV5GrZlGl59X3EZJQRwKkf60zSXse2d_ y9nNJU2SLaTLRRolOHPffWlLuqGVX94yKz4Br5nYhSx_nJ27QOUw_6GurO9K Hu.zPxqCU.9BkPPKGDD1uVQdihYo70YzpMhABPEQMC78zCEXTclfyEirBvsA wzbt7yyiKxJInsqEMkWu.rzrN6ZK5or51m7Lsx8L4dJRu.MsLj2IkdWqItQ_ llo1l5WfiUcbNiYrrLnatZpoP3ubAG5cYYsDW2XjJtD5Ezak7UrEgRlVzNus zeVbBgumWTbkR_v_RC1l3bGedsF.LpT0IHwtuOyXqi1.JfuqCnWNt8IKSqMF ktC6YsR2jR7XmiQB4a60Yc6FDotvTa2C5JrzgCb4l7pNJQqxxheMftZpG85N jFBKZEDqmmlf9INMepg2sz7T2Gj6Yp1RnvrUMbftbcJ7Zp8r4UqMyM7hPLtR u.F7jHBkcmIaWc6mhMXkpA5w3OThelkJec05F4M9p4JUX2AUwSOUTBOl9Q0k vld8HwBz_XjIS0KsmqA-- Message-ID: <0ebde82d-4449-c731-1656-0e1b29d5ed9c@yahoo.co.jp> Date: Tue, 14 Jun 2022 12:39:49 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: GCC Patches From: Takayuki 'January June' Suwa Subject: [PATCH 4/5] xtensa: Eliminate unwanted reg-reg moves during DFmode input reloads Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: , X-List-Received-Date: Tue, 14 Jun 2022 03:54:43 -0000 When spilled DFmode registers are reloaded in, once loaded into a pair of SImode regs and then copied from that regs. Such unwanted reg-reg moves seems not to be eliminated at the "cprop_hardreg" stage, despite no problem in output reloads. Luckily it is easy to resolve such inefficiencies, with the use of peephole2 pattern. gcc/ChangeLog: * config/xtensa/predicates.md (reload_operand): New predicate. * config/xtensa/xtensa.md: New peephole2 pattern. --- gcc/config/xtensa/predicates.md | 13 +++++++++++++ gcc/config/xtensa/xtensa.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md index d63a6cf034c..edd13ae41b9 100644 --- a/gcc/config/xtensa/predicates.md +++ b/gcc/config/xtensa/predicates.md @@ -165,6 +165,19 @@ (and (match_code "const_int") (match_test "xtensa_mem_offset (INTVAL (op), SFmode)"))) +(define_predicate "reload_operand" + (match_code "mem") +{ + const_rtx addr = XEXP (op, 0); + if (REG_P (addr)) + return REGNO (addr) == A1_REG; + if (GET_CODE (addr) == PLUS) + return REG_P (XEXP (addr, 0)) + && REGNO (XEXP (addr, 0)) == A1_REG + && CONST_INT_P (XEXP (addr, 1)); + return false; +}) + (define_predicate "branch_operator" (match_code "eq,ne,lt,ge")) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 9588a829136..e6f5594762f 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2724,3 +2724,34 @@ (if_then_else (match_test "TARGET_DENSITY") (const_int 5) (const_int 6)))]) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (match_operand:SI 6 "reload_operand")) + (set (match_operand:SI 1 "register_operand") + (match_operand:SI 7 "reload_operand")) + (set (match_operand:SF 2 "register_operand") + (match_operand:SF 4 "register_operand")) + (set (match_operand:SF 3 "register_operand") + (match_operand:SF 5 "register_operand"))] + "REGNO (operands[0]) == REGNO (operands[4]) + && REGNO (operands[1]) == REGNO (operands[5]) + && peep2_reg_dead_p (4, operands[0]) + && peep2_reg_dead_p (4, operands[1])" + [(set (match_dup 2) + (match_dup 6)) + (set (match_dup 3) + (match_dup 7))] +{ + uint32_t check = 0; + int i; + for (i = 0; i <= 3; ++i) + { + uint32_t mask = (uint32_t)1 << REGNO (operands[i]); + if (check & mask) + FAIL; + check |= mask; + } + operands[6] = gen_rtx_MEM (SFmode, XEXP (operands[6], 0)); + operands[7] = gen_rtx_MEM (SFmode, XEXP (operands[7], 0)); +}) -- 2.20.1