From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nh603-vm14.bullet.mail.ssk.yahoo.co.jp (nh603-vm14.bullet.mail.ssk.yahoo.co.jp [182.22.90.55]) by sourceware.org (Postfix) with SMTP id E964E386DC7B for ; Tue, 14 Jun 2022 03:54:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E964E386DC7B Received: from [182.22.66.104] by nh603.bullet.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:38 -0000 Received: from [182.22.91.133] by t602.bullet.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:38 -0000 Received: from [127.0.0.1] by omp606.mail.ssk.yahoo.co.jp with NNFMP; 14 Jun 2022 03:54:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 306886.14318.bm@omp606.mail.ssk.yahoo.co.jp Received: (qmail 82696 invoked by alias); 14 Jun 2022 03:54:38 -0000 Received: from unknown (HELO ?192.168.2.3?) (175.177.45.163 with ) by smtp6004.mail.ssk.ynwp.yahoo.co.jp with SMTP; 14 Jun 2022 03:54:38 -0000 X-YMail-JAS: JBw_6pwVM1mFo8KbFN0dc.KtpjobXCB44jgUFfSDjGDC_843NemwDdcRAF0koR8MKwycM_y5rF0..oUUwP9Y3RRona4VFwofCqkYNshQF1OXxl6xgoYBtCYwNITm378pr97zWvhyvA-- X-Apparently-From: X-YMail-OSG: 2Gx5r0sVM1lFgXqtikTGWxAX4I7Y2vkDEI27vX8qNDbek4X oLTWnVchkLfgYB85T_OhqTJQNcwldaLZY57cnq4Zbqlttz2phf9ZY8ch2bk9 ihvN2dw.oIqAmK.xrTT_zJB.tfSEBxgaOuvE7m8IiSXzCAmtmJkeqoUGpC8l tPnrWf09oMRgceUoRFxTErzvErBbkEMPlXVawCmtKGV_gHxp8jX3KLNoE8p9 fOxKPTM1GQOvaJqyBr9Qjt0rxScFzmbwWen6v2vsnxnky_6MpxA09uctg89g j.fO.hc.eMtjg50bacrj8_akv1AN0uZKIRlbedpcbtXilvNab0O.U4nca17S QV0wrYLJc8gVYoFl5Anw85fKWCSye17mxfADnM76ftGwgztpSXiMLzbKef8J bcc70EyWnYc6sDHfqEJ5WS9.ex_vius0iJFeQfr7cQ719vpoSSx3zDqXG1Xa XC3m2SbUyAHTcPS3syTO1E0tKplPDr59s8sz0oRY9ZcsWUzuO.4BhgtYSXBy lmCrapf2Nq5LdGiRT8DGsbn3iWaffk1lvK6LmEudaefCnVOP2Isa0YYayzlg fX0T6JH_yo6jjRyHmkQyRV2M5_VOCblp7Nbml.nINokZL9JFjBPNnc1cAagy Et6kbZp_BYUs2AMn20PR3Sx0X7_qKoKPfzPT.l7GsVFFQiwCQYjZFDCOSua0 DJCX3D09bMSruPCZstkvUiclsYB3jTtGqliCX9If_zv4tOD4HyWY6XPCsr0h a.Q2.sCOTJwBYdHlchJoBOZXQ0LxM3SlHE.xYPhRwDtayTTDCGvqCMsOxxBy LWHvY9WFzH5k5l1kfuQHCGhWXX4_1QmfO5e_aCg34QM4AV_muxQxTSC0Uqsx or1M3qQwTNFW0y9lpoSli794IJ8MGEUGTgOmtZBPKsmMGuzw_eLaBTyC4g37 MmQICOXc.dK28I0cN3w-- Message-ID: <6713ecef-b26f-b1ec-cfff-f41535c7d7f9@yahoo.co.jp> Date: Tue, 14 Jun 2022 12:37:54 +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 3/5] xtensa: Add some dedicated patterns that correspond to GIMPLE canonicalizations 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:42 -0000 This patch offers better RTL representations against straightforward derivations from some tree optimizers' canonicalized forms. - rounding up to even, such as '(x + (x & 1))', is canonicalized to '((x + 1) & -2)', but the former is one instruction less than the latter in Xtensa ISA. - signed greater or equal to zero as logical value '((signed)x >= 0)', is canonicalized to '((unsigned)(x ^ -1) >> 31)', but the equivalent '(((signed)x >> 31) + 1)' is one instruction less. gcc/ChangeLog: * config/xtensa/xtensa.md (*round_up_to_even): New insn-and-split pattern. (*signed_ge_zero): Ditto. --- gcc/config/xtensa/xtensa.md | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 181f935e3c3..9588a829136 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2679,3 +2679,48 @@ xtensa_expand_atomic (, operands[0], operands[1], operands[2], true); DONE; }) + +(define_insn_and_split "*round_up_to_even" + [(set (match_operand:SI 0 "register_operand" "=a") + (and:SI (plus:SI (match_operand:SI 1 "register_operand" "r") + (const_int 1)) + (const_int -2)))] + "" + "#" + "can_create_pseudo_p ()" + [(set (match_dup 2) + (and:SI (match_dup 1) + (const_int 1))) + (set (match_dup 0) + (plus:SI (match_dup 2) + (match_dup 1)))] +{ + operands[2] = gen_reg_rtx (SImode); +} + [(set_attr "type" "arith") + (set_attr "mode" "SI") + (set (attr "length") + (if_then_else (match_test "TARGET_DENSITY") + (const_int 5) + (const_int 6)))]) + +(define_insn_and_split "*signed_ge_zero" + [(set (match_operand:SI 0 "register_operand" "=a") + (ge:SI (match_operand:SI 1 "register_operand" "r") + (const_int 0)))] + "" + "#" + "" + [(set (match_dup 0) + (ashiftrt:SI (match_dup 1) + (const_int 31))) + (set (match_dup 0) + (plus:SI (match_dup 0) + (const_int 1)))] + "" + [(set_attr "type" "arith") + (set_attr "mode" "SI") + (set (attr "length") + (if_then_else (match_test "TARGET_DENSITY") + (const_int 5) + (const_int 6)))]) -- 2.20.1