From patchwork Sun Feb 4 10:20:16 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: 1895004 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=Ek7/cwhu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4TSQWq3dkMz23gM for ; Sun, 4 Feb 2024 21:20:53 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22C273857C51 for ; Sun, 4 Feb 2024 10:20:49 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw0005-vm0.mail.otm.yahoo.co.jp (omggw0005-vm0.mail.otm.yahoo.co.jp [182.22.18.106]) by sourceware.org (Postfix) with ESMTPS id 150493858D3C for ; Sun, 4 Feb 2024 10:20:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 150493858D3C 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 150493858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=182.22.18.106 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707042030; cv=none; b=OzIHuRzGdLWjlggi5yzmhQs/9Kq4BEFaENRmAgu7ukjLZgbfzpoYo4dOiOGFvefYAUDj49r0K6qsPs2emkReLwojSPIgA6wSbEOrfjdcsNrg8MEC0KZFI3nwo6XoF6GzFO+5ipYbIQmpLyQ3EBhGZ+dm+LqeHpvT/oqM8zGqnh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707042030; c=relaxed/simple; bh=qumRrabDa5FpBYBfMDJ6ra1msV42FWsyBg/oBQcw+CA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=LHbLHU/lVzLVxL9Pf0+Ya4FfYpCd0pmW6Y1gQt9ccakc8tLYJlQ8YsB06C+fhZYq4JXgl+mzjTO1kW7q9EsOT1ef+Rg7Il5h6KJNLVvXjh7jhSaQa1xZvHNWUHX8bmt2//wWQngK0OeX/lXZkvkSIjzsjBGbBb5G4rST6Sm2u4Q= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: 8Y8ej0wVM1lJLI9.46sbQQDTmgdomnV3QhEVC5Iod1Zu5v4.DcVakU1sH1vuw95 eQkV3cDD.rTkSro1QSnRFYPxxplAqh1H.DNzMgk5HydiE4JTf715GS2GRNE7gmUErpvMJ0T7Tpv. IGiHmiwVEAOHKM2vyIvdGWWr_JIFqNAkNquDc5c1wNZw8hDTQR7azMAWbx6KIeB15uxlEkCG4sN. 4GosD..dsEWuu7m3fEk_YTUCbKXpEzNvyayNRawq6f.hjSsflKNOr4fUW.O9nLLcwTq.WYfnLvQ1 IvyzuuEgDYj4vBtjtxx7Bt2_Id9L81OJi.PbbNIMt3WbX0nCfIDENVOjnJqHMH7yltpA7A7p6Xam UaoXNXaBL.gXy1bxVFFtXI.bZuYPTFrNkskPtThDTh2ps07Hq6znTBigjr8c2cIk0lx6bvM0UP6P saIC1cOUcymP9LpTSo5pgwBLeQFEu5OyR4CZsdXjcB3NQqpE8jjUARdYM1XBuOrpg6yWFqYUCYN3 8iQ90GPRpXpB1c8lh1vrhyhH209aXwxnVwrJ9GNxanTwtQ6jdpXyMz19UOjJ_1uDX6V8BJodn05X P4TqzGBUKs5zq79uyiQzGUs1vkWLnfqIjTGMUIE9_fVF0kq7ZSkEEHKHQsd.GzeYfIhaBgRTNp6P EmnxC8BkVGDdp94_xDDgVH.OBd.ILAcboUk_FNP5cV3aI5jwbcHuepVKXpaOn8N35A8lUWbSnUNj BQjERYrI7VAMh57RRnlvoo4yg.LWqpbdZ.tRyCD83t5LIQQHmXo7V40DljC7pNAwL9OTr675q6rK H9kCQDvirDMLeEUfsZLKwKZnt5SYjRBhKfzWPWqvpKLbvpTzxtv4gVezKFrxiw11yGBXVgbw.5dp KzfXJk8ngp.PIyGvR8_ksLYO0ofwsNAfyRE9TkvcrbYfzXdqW5EEVjqOvdB3lUsziWwFAsPQkxHH 4S4oN0PrLE98j6jwjOniA6W2824Sm5_VPsba3J7XCQfhkaIUM3rz2TzvxgojAQOto6i9nXnZyZkf P.fQMMYUMEIXaMU2uXlT7Rmt5iNwt.lCPdL1udQbdMGSSA.MG58v92SYQcZ6hrN.Zdv_JKlAC6JW DluzHI8fd9QH.OxJCEIY- Received: from sonicgw.mail.yahoo.co.jp by sonicconh6003.mail.ssk.yahoo.co.jp with HTTP; Sun, 4 Feb 2024 10:20:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1707042016; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=pm0a4r8JA/5f8n3+Y0mKx4LgfAuznoq7kdSqiGq1ezo=; b=Ek7/cwhu/ZYEfIMNVo6GLEFFDW3hQzmMK0vpOJntibDYsIhmxusbcV+L6bNUw4u0 H5R4jnVhLspqKPMeonIVGo0PsLsrrBI+ffobWRt4Gu+jX+cpliDMHPdlIcf0Ld3HZQ0 g/JtqtnHja+JSAReqt05pgMfHaTJtv8cpFXW7fNk= 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=MQvt4lfhDU1KoXJ9SGDwynf5pGw6dDqmZjvkbAwn4icS/Fo106Wv93GvwAasRj7p ArUBU94U3xEMm+MaXXgETua7GWnKx487qfs/lcsl+25YOsz3DBKybM2KjHC4clZPd33 SrNGb3uImKaVM+nuvYpMBhz8ETZA4s3KrukTx2zY=; Received: by smtphe6010.mail.ssk.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 475af10af6bcffb71ebe332929134485; Sun, 04 Feb 2024 19:20:18 +0900 (JST) Message-ID: <2c6cd2b5-e436-4608-a0b7-ad8a57bc186b@yahoo.co.jp> Date: Sun, 4 Feb 2024 19:20:16 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: GCC Patches Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH 1/2 v2] xtensa: Recover constant synthesis for HImode after LRA transition References: <2c6cd2b5-e436-4608-a0b7-ad8a57bc186b.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, 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 (SHI): New mode iterator. (2 split patterns related to constsynth): Change to also accept HImode operands. --- gcc/config/xtensa/xtensa.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 13b8b57f1fc..1a2249b059a 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -87,6 +87,10 @@ ;; the same template. (define_mode_iterator HQI [HI QI]) +;; This mode iterator allows the SI and HI patterns to be defined from +;; the same template. +(define_mode_iterator SHI [SI HI]) + ;; Attributes. @@ -1291,28 +1295,30 @@ (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:SHI 0 "register_operand") + (match_operand:SHI 1 "const_int_operand"))] "!TARGET_CONST16 && !TARGET_AUTO_LITPOOLS && ! xtensa_split1_finished_p () && ! xtensa_simm12b (INTVAL (operands[1]))" [(set (match_dup 0) (match_dup 1))] { - operands[1] = force_const_mem (SImode, operands[1]); + operands[1] = force_const_mem (mode, operands[1]); }) (define_split - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "constantpool_operand"))] + [(set (match_operand:SHI 0 "register_operand") + (match_operand:SHI 1 "constantpool_operand"))] "! optimize_debug && reload_completed" [(const_int 0)] { - rtx x = avoid_constant_pool_reference (operands[1]); + rtx x = avoid_constant_pool_reference (operands[1]), dst = operands[0]; if (! CONST_INT_P (x)) FAIL; - if (! xtensa_constantsynth (operands[0], INTVAL (x))) - emit_move_insn (operands[0], x); + if (mode == HImode) + dst = gen_rtx_REG (SImode, REGNO (dst)); + if (! xtensa_constantsynth (dst, INTVAL (x))) + emit_move_insn (dst, x); DONE; })