From patchwork Sat Feb 3 14:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 1894909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yahoo.co.jp header.i=@yahoo.co.jp header.a=rsa-sha256 header.s=yj20110701 header.b=L+HTd8r6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TRvtl729hz23gM for ; Sun, 4 Feb 2024 01:20:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F21743857BAA for ; Sat, 3 Feb 2024 14:20:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw0006.mail.otm.yahoo.co.jp (omggw0006.mail.otm.yahoo.co.jp [182.22.18.30]) by sourceware.org (Postfix) with ESMTPS id 9C4023858404 for ; Sat, 3 Feb 2024 14:20:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C4023858404 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C4023858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=182.22.18.30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706970003; cv=none; b=HyqbPiWUr8f/ZpLYZfkRXQ4a6fYkrSLyJo6r4sNAuJ3FNgPBcYA/ZJqUnfP5XRDqsBkIBOJs7vV1mCpcsUDHD4qzag8sqCEeMiYa7hgHRimhMh8hD4k9KiPKH+fQY229KmWQzjTLWeqxE4xVdUTi/Zy5WXcCvsfbZAW02Ywgv4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706970003; c=relaxed/simple; bh=qMj3L0Q7nbDHbPfEmzmRLjL2Uu0eyijMp7OR2iwHiss=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=CMiuW6R6/uFs4HsQ0aYirP5l/LyqEeXZlX+DFeq+Iu7f7do8lbRG1AaqYLUSb/lwnDIwX2bPcLvexGJGlHE+aOzcXK2EPO3bWxUU2xB4971ZN6sWEIWwQxaARM14LhVtLeZJepznx9Q+jy7DCFoJLT6srOl6f8KsDAc+SPxFrUM= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: SGTbdKoVM1mxr9O7enjvlrLzMvccnzbXr2XUBtnfcjlPH25u2gK9gdcLcaodtqC ZqaAXsTbxQ.sx3NFd0vRhAZ178qSMU7cQwRbWowAHosYWeuhhi2teKMIieszju.Zjgx_dCRq9GCj Lzr13WRSvtez8fzTVzjZ2.jgNABqbaLNiIS6ib1AmNtq152deUPI21wi2elWHXfsYSmfO_Be1knM 5690Izjmx28_Rq4UQw6Hn_vZ09jrafE0KxigPHDYK.mCDGT9Hml24zqHXXSCunZuo3KSIKqaOcPO XfEfdSnoBA4PwykB9KguEnfRoxRcb5KtRestYL6OGXsCmSmNNUi.43c7_zXJuhQ5EIemwbn6ZOL0 51ZBFsOsb12BYGhH93vCTxcopKBmSyBwT5iHCgp1ILGWy_werVcEe1cReFgGALac7DVA8WrIsfz5 k7dNPQx_XasgRhACAIujtO6FhBIPy0UkMYS5S8dspfrUUH7PsTQZoLsJD8Bwq7gdWsRnYdhsBcwM uEQ2b53Jawd.XH874JctxR0Kzv.BBl4R1xKDr3b3L3i1_VCYkmgj3WIzoR7nP_wvfj9ulKLI9szN ijpI.kxc.LFG7yHl55_pm705xJDuYwhAKNKkiLPVuMgiOsk4jMONwpXRCQnRzDqLJb5k6TPT_aCh .a2lev7VHnakk66D9JcvsXhGgqfvngP0r1Zk3rI3MyqbGOYZ2DLDlCtQ6o7NKW_AuQ8Bfj1.ylWs wbQu7OGIRAj5SmWpqhk2OYxazCu2zS2h4xh3Cq2117DFEucwV4aS9f4do.895DN.ABLsl_fxV9_g yuUrqPrABKW5aBgIZo9EA2TYQK2kB_OWiQQQyakEThFa1KPe4fGRs6SqGsW8kns195tbWiT77gli iCGxFQQNm_hHjPlWCWIQg6of9I.bVqQLv6erjSZxFKFp8PKBqsg8H6bChVbphl9iGtcJE8fy06Eh k_vwcTu9hWTftT_h6o9Qwc6fDnl3anisU9Pc0NJoyKwwItMyVYdN6pnee1KILZrFJHzUgGXspLO_ JMknA_11pswD2jfbeuFcgJh.DHiR_8Z7Hz9Nv4R7ZlD.vpuyqHxx3MSeOUmPdpxVJfwkDv1SphF2 RqaPObW4LHxazq77pp4k- Received: from sonicgw.mail.yahoo.co.jp by sonicconh6003.mail.ssk.yahoo.co.jp with HTTP; Sat, 3 Feb 2024 14:19:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1706969879; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=oarGUhc5T9MLBOYYp6XIsGL5z2gn/xipEnx0o+bwjUU=; b=L+HTd8r69V51fyFoRWT4/lI6dJ674r0pmIcazxbJZpc/5TXhuLRdOGxd9DhZIl8H xZmKiZwp0nugEtvYD9Sy96UIg4tLpfEcqqpcuUAoNrY0fysr8/zCBE55vTckuB0VS5K pmSh02gLEM88riFdhWUQqMyJ94r2MTTdnSbSyG28= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Cc:From:Content-Type:Content-Transfer-Encoding:References; b=GqTHUGr49nlK9gpprXL648bSMuaiLBpShGDNRGa8mS59AQMHrJn9S6caxG4INdGk kvp7x8e0ooVD1oh1enQ9+9t+lq1iCDdYOAVccNTjLSJ4kBlzb/XvOYacRGP04ncD+jQ 7o/+OKgphQijIU41uBhrr0A6HaaHtS+lZeFiAJ9k=; Received: by smtphe6010.mail.ssk.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID b0de37c141d6d031d90ed9d0ddfa6186; Sat, 03 Feb 2024 23:19:56 +0900 (JST) Message-ID: <426f1bc2-0840-41f4-bb7e-d6037baf9068@yahoo.co.jp> Date: Sat, 3 Feb 2024 23:17:59 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: GCC Patches Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH 1/2] xtensa: Recover constant synthesis for HImode after LRA transition References: <426f1bc2-0840-41f4-bb7e-d6037baf9068.ref@yahoo.co.jp> X-Spam-Status: No, score=-13.0 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org After LRA transition, HImode constants that don't fit into signed 12 bits are no longer subject to constant synthesis: /* example */ void test(void) { short foo = 32767; __asm__ ("" :: "r"(foo)); } ;; before .literal_position .literal .LC0, 32767 test: l32r a9, .LC0 ret.n This patch fixes that: ;; after test: movi.n a9, -1 extui a9, a9, 17, 15 ret.n gcc/ChangeLog: * config/xtensa/xtensa.md (2 split patterns related to constsynth): Change to also accept HImode operands. --- gcc/config/xtensa/xtensa.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index f3953aa26b0..5242eb3c006 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1291,28 +1291,36 @@ (set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")]) (define_split - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "const_int_operand"))] + [(set (match_operand 0 "register_operand") + (match_operand 1 "const_int_operand"))] "!TARGET_CONST16 && !TARGET_AUTO_LITPOOLS && ! xtensa_split1_finished_p () - && ! xtensa_simm12b (INTVAL (operands[1]))" + && ! xtensa_simm12b (INTVAL (operands[1])) + && GET_MODE (operands[0]) == GET_MODE (operands[1]) + && (GET_MODE (operands[0]) == SImode + || GET_MODE (operands[0]) == HImode)" [(set (match_dup 0) (match_dup 1))] { - operands[1] = force_const_mem (SImode, operands[1]); + operands[1] = force_const_mem (GET_MODE (operands[0]), operands[1]); }) (define_split - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "constantpool_operand"))] - "! optimize_debug && reload_completed" + [(set (match_operand 0 "register_operand") + (match_operand 1 "constantpool_operand"))] + "! optimize_debug && reload_completed + && GET_MODE (operands[0]) == GET_MODE (operands[1]) + && (GET_MODE (operands[0]) == SImode + || GET_MODE (operands[0]) == HImode)" [(const_int 0)] { - rtx x = avoid_constant_pool_reference (operands[1]); - if (! CONST_INT_P (x)) + rtx x, dst; + if (! CONST_INT_P (x = avoid_constant_pool_reference (operands[1]))) FAIL; - if (! xtensa_constantsynth (operands[0], INTVAL (x))) - emit_move_insn (operands[0], x); + if (GET_MODE (dst = operands[0]) == HImode) + dst = gen_rtx_REG (SImode, REGNO (dst)); + if (! xtensa_constantsynth (dst, INTVAL (x))) + emit_move_insn (dst, x); DONE; })