From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omggw0003-vm1.mail.otm.yahoo.co.jp (omggw0003-vm1.mail.otm.yahoo.co.jp [182.22.18.81]) by sourceware.org (Postfix) with ESMTPS id A64713858D32 for ; Mon, 8 May 2023 14:44:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A64713858D32 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 X-YMail-OSG: Ff7dGbcVM1mAdFpy6slq2Q7aRUxnGZpjJk8L_zzRG0dUEwmyz.oFKR5EPaILf22 zGQkoXnQMUxkijpzr0F9n0RLwcqr7imPl1DAQLDIZAqssuGDsoAEbGtuGTyPBOWeqv6ZS_xp.bpK Fy7al5E4Iz02Z5garyifbKbBJkSWDa8nSxXnzdrxsYtPvIV7DmIZeEjqH9w92r3AOpYQZm8GyTl8 AQpzhz5y..1h4VB_rxdNsnRIlSqTrGlnMVMOw2MjLKSobOz7feBp_tQjYD5O2.ecRYExSgFeeLVH 1ECYj7bXZLdYpVZccPsJZEnB6hrVsq1o.vhuEhYLd07shItwS7Y.1nBleTMrRBDTv6yOnPVil9jk KHz61RVWhcAgxp.x_XCOQURX98S5gSjCmBb5WFIg70gj2tXEkJFy7Jy_arhRTJFkGO6bI3XJL4pb G3Vi1jjr.hjv272ro2EuZZ.FTGh_Px4QgcgW8NzDuXK2JN4cmKswVURi8izsxjCPb_UU4HP6PCWa cJW2.KUrYXQWdYpCk27NLzkTVdgXpGO4y.gQ5Tu21iM6BHN7GqR8mo5K19vcNvDoCl5vbRW6MYv. RNoNNszkWOgMdqINo79G0nelNkPfycLbJxXAmtLCt6IPUWp7IdZzjANND7TJcmUA7lfVS75_ZLiq DRzc_rJzOMvf9sHYz0vxA5fgly0LKB_A8aMSFGiJaSh4GNqgN6evs7zvjUCpszzTX.XNi020c1g1 3PQ0hgEN8g4Nw7KvtFrPBXRNXPaL.HSF3NXsUF7XmnptkO1hGU8KjhaiJHE76GTxJYmasohQGvLi cFzq_YvJdFIRzOWyThoCIafiicmDlk0WFhkZZJnoLOJUNvuczAAVVgz7339980SMARg1nhN8.V_3 dUvbwyA4X5rirvE_eX3EHhGgp26e6mYt_DF_V3Obl1lgtWZ8L_WhHeOtUb3IFogUKZTZB_IgeMSD wMLKjaVsn8oXHd83JUJFHyTxKxFHEuoDFN_Hg0AvRXtCmmKkeMXNk3UN.5g_e4TCq Received: from sonicgw.mail.yahoo.co.jp by sonicconh6003.mail.ssk.yahoo.co.jp with HTTP; Mon, 8 May 2023 14:44:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1683557045; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=01ED7gcmNMYD32deqwfU+QwhfNhRNEzVwtthaB14IjU=; b=M2dopP/4i669Ke27wq1GPGD6Gaxk6ya+mIhoUK8kQcAlU7yeTsJl8SjdWrFeGbCU KoYDkhnu3OPJC6SkTMoD4To/GpS4wtEK6Yj4CeSYD49sk3asUrj0pDS//p3rFYG5W8l HwB0KwU/haP9OeGuGNcDNd6Ye/B55j+vIjH8sBjw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:References:Cc:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=sEkuNa5Ld0l5p5iURMcDsMZ3R1jodPKLKNSnF/XBejtho2bagFHck5RBypkmKF3I mggvbbjiDjqyQvCqZ4rm2LZhc6VgnD9kEXhi4earu7ZDtxg2cClWbB81QW+ksJy16RC 99J1ByqqTqRAPylmN+7pRC7UoNtPuKxAHlbbsbo0=; Received: by smtphe6007.mail.ssk.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID c184ebb898314dc912828ae837d496d4; Mon, 08 May 2023 23:44:01 +0900 (JST) Message-ID: <42c4f026-3045-c469-e62f-24d7c26cd431@yahoo.co.jp> Date: Mon, 8 May 2023 23:44:00 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: [PATCH v2] xtensa: Make full transition to LRA To: Richard Biener , GCC Patches References: <91ddbcb5-67e2-2c30-a81e-6b20e3c8e1a4.ref@yahoo.co.jp> <91ddbcb5-67e2-2c30-a81e-6b20e3c8e1a4@yahoo.co.jp> Cc: Max Filippov From: Takayuki 'January June' Suwa In-Reply-To: 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,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 List-Id: On 2023/05/08 22:43, Richard Biener wrote: [snip] >> -mlra > > If they were in any released compiler options should be kept > (doing nothing) for backward compatibility. Use for example > > mlra > Target WarnRemoved > Removed in GCC 14. This switch has no effect. > > or > > mlra > Target Ignore > Does nothing. Preserved for backward compatibility. > > which doesn't inform the user (I think that's the better choice here). > >> -Target Mask(LRA) Thank you for your helpful advice. ===== gcc/ChangeLog: * config/xtensa/constraints.md (R, T, U): Change define_constraint to define_memory_constraint. * config/xtensa/xtensa.cc (xtensa_lra_p, TARGET_LRA_P): Remove. (xtensa_emit_move_sequence): Remove "if (reload_in_progress)" clause as it can no longer be true. (xtensa_output_integer_literal_parts): Consider 16-bit wide constants. (xtensa_legitimate_constant_p): Add short-circuit path for integer load instructions. * config/xtensa/xtensa.md (movsf): Use can_create_pseudo_p() rather reload_in_progress and reload_completed. * config/xtensa/xtensa.opt (mlra): Change to no effect. --- gcc/config/xtensa/constraints.md | 26 ++++++++------------------ gcc/config/xtensa/xtensa.cc | 26 +++++--------------------- gcc/config/xtensa/xtensa.md | 2 +- gcc/config/xtensa/xtensa.opt | 4 ++-- 4 files changed, 16 insertions(+), 42 deletions(-) diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md index 53e4d0d8dd1..9b31e162941 100644 --- a/gcc/config/xtensa/constraints.md +++ b/gcc/config/xtensa/constraints.md @@ -123,29 +123,19 @@ (and (match_code "const_int") (match_test "! xtensa_split1_finished_p ()")))) -;; Memory constraints. Do not use define_memory_constraint here. Doing so -;; causes reload to force some constants into the constant pool, but since -;; the Xtensa constant pool can only be accessed with L32R instructions, it -;; is always better to just copy a constant into a register. Instead, use -;; regular constraints but add a check to allow pseudos during reload. +;; Memory constraints. -(define_constraint "R" +(define_memory_constraint "R" "Memory that can be accessed with a 4-bit unsigned offset from a register." - (ior (and (match_code "mem") - (match_test "smalloffset_mem_p (op)")) - (and (match_code "reg") - (match_test "reload_in_progress - && REGNO (op) >= FIRST_PSEUDO_REGISTER")))) + (and (match_code "mem") + (match_test "smalloffset_mem_p (op)"))) -(define_constraint "T" +(define_memory_constraint "T" "Memory in a literal pool (addressable with an L32R instruction)." (and (match_code "mem") (match_test "!TARGET_CONST16 && constantpool_mem_p (op)"))) -(define_constraint "U" +(define_memory_constraint "U" "Memory that is not in a literal pool." - (ior (and (match_code "mem") - (match_test "! constantpool_mem_p (op)")) - (and (match_code "reg") - (match_test "reload_in_progress - && REGNO (op) >= FIRST_PSEUDO_REGISTER")))) + (and (match_code "mem") + (match_test "! constantpool_mem_p (op)"))) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 9e5d314e143..f4434ec6e2c 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -190,7 +190,6 @@ static void xtensa_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function); -static bool xtensa_lra_p (void); static rtx xtensa_delegitimize_address (rtx); @@ -286,9 +285,6 @@ static rtx xtensa_delegitimize_address (rtx); #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM xtensa_cannot_force_const_mem -#undef TARGET_LRA_P -#define TARGET_LRA_P xtensa_lra_p - #undef TARGET_LEGITIMATE_ADDRESS_P #define TARGET_LEGITIMATE_ADDRESS_P xtensa_legitimate_address_p @@ -1266,14 +1262,6 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode) operands[1] = xtensa_copy_incoming_a7 (operands[1]); - /* During reload we don't want to emit (subreg:X (mem:Y)) since that - instruction won't be recognized after reload, so we remove the - subreg and adjust mem accordingly. */ - if (reload_in_progress) - { - operands[0] = fixup_subreg_mem (operands[0]); - operands[1] = fixup_subreg_mem (operands[1]); - } return 0; } @@ -3196,7 +3184,7 @@ xtensa_output_integer_literal_parts (FILE *file, rtx x, int size) fputs (", ", file); xtensa_output_integer_literal_parts (file, second, size / 2); } - else if (size == 4) + else if (size == 4 || size == 2) { output_addr_const (file, x); } @@ -4876,6 +4864,10 @@ xtensa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain) static bool xtensa_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x) { + if (CONST_INT_P (x)) + return TARGET_AUTO_LITPOOLS || TARGET_CONST16 + || xtensa_simm12b (INTVAL (x)); + return !xtensa_tls_referenced_p (x); } @@ -5317,12 +5309,4 @@ xtensa_delegitimize_address (rtx op) return op; } -/* Implement TARGET_LRA_P. */ - -static bool -xtensa_lra_p (void) -{ - return TARGET_LRA; -} - #include "gt-xtensa.h" diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 3521fa33b47..195515d9427 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1268,7 +1268,7 @@ if ((!register_operand (operands[0], SFmode) && !register_operand (operands[1], SFmode)) || (FP_REG_P (xt_true_regnum (operands[0])) - && !(reload_in_progress | reload_completed) + && can_create_pseudo_p () && (constantpool_mem_p (operands[1]) || CONSTANT_P (operands[1])))) operands[1] = force_reg (SFmode, operands[1]); diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt index f16b53bf409..19c9bd37a18 100644 --- a/gcc/config/xtensa/xtensa.opt +++ b/gcc/config/xtensa/xtensa.opt @@ -38,8 +38,8 @@ Target RejectNegative Joined UInteger Var(xtensa_extra_l32r_costs) Init(0) Set extra memory access cost for L32R instruction, in clock-cycle units. mlra -Target Mask(LRA) -Use LRA instead of reload (transitional). +Target Ignore +Does nothing. Preserved for backward compatibility. mtarget-align Target -- 2.30.2