* [PATCH] xtensa: Make full transition to LRA [not found] <91ddbcb5-67e2-2c30-a81e-6b20e3c8e1a4.ref@yahoo.co.jp> @ 2023-05-08 13:38 ` Takayuki 'January June' Suwa 2023-05-08 13:43 ` Richard Biener 2023-05-10 9:10 ` [PATCH] xtensa: Make full transition to LRA Max Filippov 0 siblings, 2 replies; 9+ messages in thread From: Takayuki 'January June' Suwa @ 2023-05-08 13:38 UTC (permalink / raw) To: GCC Patches; +Cc: Max Filippov 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): Remove. --- 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, 14 insertions(+), 44 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..8574c12198e 100644 --- a/gcc/config/xtensa/xtensa.opt +++ b/gcc/config/xtensa/xtensa.opt @@ -37,10 +37,6 @@ mextra-l32r-costs= 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). - mtarget-align Target Automatically align branch targets to reduce branch penalties. -- 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] xtensa: Make full transition to LRA 2023-05-08 13:38 ` [PATCH] xtensa: Make full transition to LRA Takayuki 'January June' Suwa @ 2023-05-08 13:43 ` Richard Biener 2023-05-08 14:44 ` [PATCH v2] " Takayuki 'January June' Suwa 2023-05-10 9:10 ` [PATCH] xtensa: Make full transition to LRA Max Filippov 1 sibling, 1 reply; 9+ messages in thread From: Richard Biener @ 2023-05-08 13:43 UTC (permalink / raw) To: Takayuki 'January June' Suwa; +Cc: GCC Patches, Max Filippov On Mon, May 8, 2023 at 3:39 PM Takayuki 'January June' Suwa via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > 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): Remove. > --- > 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, 14 insertions(+), 44 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..8574c12198e 100644 > --- a/gcc/config/xtensa/xtensa.opt > +++ b/gcc/config/xtensa/xtensa.opt > @@ -37,10 +37,6 @@ mextra-l32r-costs= > Target RejectNegative Joined UInteger Var(xtensa_extra_l32r_costs) Init(0) > Set extra memory access cost for L32R instruction, in clock-cycle units. > > -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) > -Use LRA instead of reload (transitional). > - > mtarget-align > Target > Automatically align branch targets to reduce branch penalties. > -- > 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] xtensa: Make full transition to LRA 2023-05-08 13:43 ` Richard Biener @ 2023-05-08 14:44 ` Takayuki 'January June' Suwa 2023-05-08 22:26 ` Jeff Law 0 siblings, 1 reply; 9+ messages in thread From: Takayuki 'January June' Suwa @ 2023-05-08 14:44 UTC (permalink / raw) To: Richard Biener, GCC Patches; +Cc: Max Filippov 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] xtensa: Make full transition to LRA 2023-05-08 14:44 ` [PATCH v2] " Takayuki 'January June' Suwa @ 2023-05-08 22:26 ` Jeff Law 2025-10-09 21:33 ` [PATCH 3/3] xtensa: Make all memory constraints special Takayuki 'January June' Suwa 0 siblings, 1 reply; 9+ messages in thread From: Jeff Law @ 2023-05-08 22:26 UTC (permalink / raw) To: Takayuki 'January June' Suwa, Richard Biener, GCC Patches Cc: Max Filippov On 5/8/23 08:44, Takayuki 'January June' Suwa via Gcc-patches wrote: > 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)"))) Given the old comment, you might want to use define_special_memory_constraint rather than define_memory_constraint. It might be worth doing some before/after comparisons to see if there's any noticeable impact. jeff ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] xtensa: Make all memory constraints special 2023-05-08 22:26 ` Jeff Law @ 2025-10-09 21:33 ` Takayuki 'January June' Suwa 2025-10-20 16:36 ` Max Filippov 0 siblings, 1 reply; 9+ messages in thread From: Takayuki 'January June' Suwa @ 2025-10-09 21:33 UTC (permalink / raw) To: gcc-patches; +Cc: Max Filippov, Jeff Law In a previous commit (fb7b82964f54192d0723a45c0657d2eb7c5ac97c), we fixed an issue where loads from literal pool to a hardware floating-point register were double- indirected; that is, the address of the literal pool entry was temporarily loaded from another entry into the address (GP) register, and then loaded from that address into the FP register. However, we discovered that the same issue could occur in rare cases when loading FP constants into address registers. Similarly, this problem can be avoided by prefixing the corresponding alternative constraint with '^' to increase the cost of Reload/LRA, but as a more fundamental and comprehensive solution, this patch defines all memory constraint definitions using define_special_memory_constraint, so that reloads cannot occur for addresses (based on a good suggestion from Jeff Law). gcc/ChangeLog: * config/xtensa/constraints.md (R, U): Change define_memory_constraint to define_special_memory_constraint. * config/xtensa/xtensa.md (movsi_internal, movhi_internal, movqi_internal): Rearrange their alternatives in the order of constant assignment, register- register move, load, store and special. And also consolidate overlapping alternatives. (movsf_internal): Rearrange the alternatives as above, and remove the '^' alternative character which is no longer needed. --- gcc/config/xtensa/constraints.md | 4 ++-- gcc/config/xtensa/xtensa.md | 36 +++++++++++++++----------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md index 08fdab1c2e7..7322107eaa3 100644 --- a/gcc/config/xtensa/constraints.md +++ b/gcc/config/xtensa/constraints.md @@ -126,7 +126,7 @@ ;; Memory constraints. -(define_memory_constraint "R" +(define_special_memory_constraint "R" "Memory that can be accessed with a 4-bit unsigned offset from a register." (and (match_code "mem") (match_test "smalloffset_mem_p (op)"))) @@ -136,7 +136,7 @@ (and (match_code "mem") (match_test "!TARGET_CONST16 && constantpool_mem_p (op)"))) -(define_memory_constraint "U" +(define_special_memory_constraint "U" "Memory that is not in a literal pool." (and (match_code "mem") (match_test "! constantpool_mem_p (op)"))) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 950c33f859f..aa64808ea62 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1263,18 +1263,16 @@ "xtensa_valid_move (SImode, operands)" {@ [cons: =0, 1; attrs: type, length] [ D, M; move , 2] movi.n\t%0, %x1 - [ D, D; move , 2] mov.n\t%0, %1 - [ D, d; move , 2] ^ - [ D, R; load , 2] %v1l32i.n\t%0, %1 - [ R, D; store, 2] %v0s32i.n\t%1, %0 - [ R, d; store, 2] ^ - [ a, r; move , 3] mov\t%0, %1 - [ q, r; move , 3] movsp\t%0, %1 [ a, I; move , 3] movi\t%0, %x1 - [ a, Y; load , 3] movi\t%0, %1 [ W, i; move , 6] const16\t%0, %t1\;const16\t%0, %b1 + [ a, Y; load , 3] movi\t%0, %1 [ a, T; load , 3] %v1l32r\t%0, %1 + [ q, r; move , 3] movsp\t%0, %1 + [ D, Dd; move , 2] mov.n\t%0, %1 + [ a, r; move , 3] mov\t%0, %1 + [ D, R; load , 2] %v1l32i.n\t%0, %1 [ a, U; load , 3] %v1l32i\t%0, %1 + [ R, Dd; store, 2] %v0s32i.n\t%1, %0 [ U, r; store, 3] %v0s32i\t%1, %0 [*a, *A; rsr , 3] rsr\t%0, ACCLO [*A, *r; wsr , 3] wsr\t%1, ACCLO @@ -1310,11 +1308,11 @@ "xtensa_valid_move (HImode, operands)" {@ [cons: =0, 1; attrs: type, length] [ D, M; move , 2] movi.n\t%0, %x1 - [ D, d; move , 2] mov.n\t%0, %1 - [ a, r; move , 3] mov\t%0, %1 [ a, I; move , 3] movi\t%0, %x1 [ a, Y; load , 3] movi\t%0, %1 [ a, T; load , 3] %v1l32r\t%0, %1 + [ D, d; move , 2] mov.n\t%0, %1 + [ a, r; move , 3] mov\t%0, %1 [ a, U; load , 3] %v1l16ui\t%0, %1 [ U, r; store, 3] %v0s16i\t%1, %0 [*a, *A; rsr , 3] rsr\t%0, ACCLO @@ -1339,9 +1337,9 @@ "xtensa_valid_move (QImode, operands)" {@ [cons: =0, 1; attrs: type, length] [ D, M; move , 2] movi.n\t%0, %x1 + [ a, I; move , 3] movi\t%0, %x1 [ D, d; move , 2] mov.n\t%0, %1 [ a, r; move , 3] mov\t%0, %1 - [ a, I; move , 3] movi\t%0, %x1 [ a, U; load , 3] %v1l8ui\t%0, %1 [ U, r; store, 3] %v0s8i\t%1, %0 [*a, *A; rsr , 3] rsr\t%0, ACCLO @@ -1412,20 +1410,20 @@ && !(FP_REG_P (xt_true_regnum (operands[0])) && (constantpool_mem_p (operands[1]) || CONSTANT_P (operands[1]))))" {@ [cons: =0, 1; attrs: type, length] - [f, f; farith, 3] mov.s\t%0, %1 - [f, ^U; fload , 3] %v1lsi\t%0, %1 - [U, f; fstore, 3] %v0ssi\t%1, %0 - [D, d; move , 2] mov.n\t%0, %1 + [W, iF; move , 6] const16\t%0, %t1\;const16\t%0, %b1 + [a, Y; load , 3] movi\t%0, %y1 [a, T; load , 3] %v1l32r\t%0, %1 - [D, R; load , 2] %v1l32i.n\t%0, %1 - [R, d; store , 2] %v0s32i.n\t%1, %0 + [D, d; move , 2] mov.n\t%0, %1 [a, r; move , 3] mov\t%0, %1 + [f, f; farith, 3] mov.s\t%0, %1 [f, r; farith, 3] wfr\t%0, %1 [a, f; farith, 3] rfr\t%0, %1 - [a, Y; load , 3] movi\t%0, %y1 - [W, iF; move , 6] const16\t%0, %t1\;const16\t%0, %b1 + [D, R; load , 2] %v1l32i.n\t%0, %1 [a, U; load , 3] %v1l32i\t%0, %1 + [f, U; fload , 3] %v1lsi\t%0, %1 + [R, d; store , 2] %v0s32i.n\t%1, %0 [U, r; store , 3] %v0s32i\t%1, %0 + [U, f; fstore, 3] %v0ssi\t%1, %0 } [(set_attr "mode" "SF")]) -- 2.39.5 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] xtensa: Make all memory constraints special 2025-10-09 21:33 ` [PATCH 3/3] xtensa: Make all memory constraints special Takayuki 'January June' Suwa @ 2025-10-20 16:36 ` Max Filippov 0 siblings, 0 replies; 9+ messages in thread From: Max Filippov @ 2025-10-20 16:36 UTC (permalink / raw) To: Takayuki 'January June' Suwa; +Cc: gcc-patches, Jeff Law On Thu, Oct 9, 2025 at 2:37 PM Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> wrote: > > In a previous commit (fb7b82964f54192d0723a45c0657d2eb7c5ac97c), we fixed an issue > where loads from literal pool to a hardware floating-point register were double- > indirected; that is, the address of the literal pool entry was temporarily loaded > from another entry into the address (GP) register, and then loaded from that > address into the FP register. However, we discovered that the same issue could > occur in rare cases when loading FP constants into address registers. > > Similarly, this problem can be avoided by prefixing the corresponding alternative > constraint with '^' to increase the cost of Reload/LRA, but as a more fundamental > and comprehensive solution, this patch defines all memory constraint definitions > using define_special_memory_constraint, so that reloads cannot occur for addresses > (based on a good suggestion from Jeff Law). > > gcc/ChangeLog: > > * config/xtensa/constraints.md (R, U): > Change define_memory_constraint to define_special_memory_constraint. > * config/xtensa/xtensa.md > (movsi_internal, movhi_internal, movqi_internal): > Rearrange their alternatives in the order of constant assignment, register- > register move, load, store and special. And also consolidate overlapping > alternatives. > (movsf_internal): Rearrange the alternatives as above, and remove the '^' > alternative character which is no longer needed. > --- > gcc/config/xtensa/constraints.md | 4 ++-- > gcc/config/xtensa/xtensa.md | 36 +++++++++++++++----------------- > 2 files changed, 19 insertions(+), 21 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Whole series committed to master. Sorry about the delay. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] xtensa: Make full transition to LRA 2023-05-08 13:38 ` [PATCH] xtensa: Make full transition to LRA Takayuki 'January June' Suwa 2023-05-08 13:43 ` Richard Biener @ 2023-05-10 9:10 ` Max Filippov 2024-01-24 5:07 ` Max Filippov 1 sibling, 1 reply; 9+ messages in thread From: Max Filippov @ 2023-05-10 9:10 UTC (permalink / raw) To: Takayuki 'January June' Suwa; +Cc: GCC Patches Hi Suwa-san, On Mon, May 8, 2023 at 6:38 AM Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> wrote: > > 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): Remove. > --- > 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, 14 insertions(+), 44 deletions(-) That's impressive. This version introduces a few execution failures in the testsuite on little endian targets and a bunch more (but not all, some execution tests still pass) on big endian. I'm traveling this week and likely won't be able to take a deep look into it until 5/15. New LE failures: +FAIL: gcc.c-torture/execute/pr56866.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.dg/torture/pr45764.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.dg/torture/pr45764.c -O3 -g execution test +FAIL: gfortran.dg/c-interop/section-2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/c-interop/section-2p.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/c-interop/section-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/c-interop/section-3p.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/bind-c-contiguous-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/bind-c-contiguous-3.f90 -O3 -g execution test +FAIL: gfortran.dg/check_bits_2.f90 -O1 output pattern test +FAIL: gfortran.dg/coarray_ptr_comp_1.f08 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/coarray_ptr_comp_1.f08 -O3 -g execution test +FAIL: gfortran.dg/loc_2.f90 -O2 execution test +FAIL: gfortran.dg/loc_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/loc_2.f90 -O3 -g execution test +FAIL: gfortran.dg/loc_2.f90 -Os execution test +FAIL: gfortran.dg/sizeof_6.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.fortran-torture/execute/forall_7.f90 execution, -O2 -fbounds-check New BE failures: +FAIL: gcc.c-torture/execute/builtins/memset-chk.c execution, -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions +FAIL: gcc.c-torture/execute/builtins/memset-chk.c execution, -O3 -g +FAIL: gcc.c-torture/execute/20000412-3.c -O2 execution test +FAIL: gcc.c-torture/execute/20000412-3.c -O3 -g execution test +FAIL: gcc.c-torture/execute/20000412-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/20020201-1.c -O2 execution test +FAIL: gcc.c-torture/execute/20020201-1.c -O3 -g execution test +FAIL: gcc.c-torture/execute/20020201-1.c -Os execution test +FAIL: gcc.c-torture/execute/20020201-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/20030224-2.c -O0 execution test +FAIL: gcc.c-torture/execute/20040629-1.c -O0 execution test +FAIL: gcc.c-torture/execute/20040629-1.c -O1 execution test +FAIL: gcc.c-torture/execute/20040705-1.c -O0 execution test +FAIL: gcc.c-torture/execute/20040705-1.c -O1 execution test +FAIL: gcc.c-torture/execute/20040705-2.c -O0 execution test +FAIL: gcc.c-torture/execute/20040705-2.c -O1 execution test +FAIL: gcc.c-torture/execute/930603-3.c -O2 execution test +FAIL: gcc.c-torture/execute/930603-3.c -O3 -g execution test +FAIL: gcc.c-torture/execute/930603-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/931004-10.c -O2 execution test +FAIL: gcc.c-torture/execute/931004-10.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/931004-10.c -O3 -g execution test +FAIL: gcc.c-torture/execute/931004-10.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/931004-10.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.c-torture/execute/931004-7.c -O2 execution test +FAIL: gcc.c-torture/execute/931004-7.c -O3 -g execution test +FAIL: gcc.c-torture/execute/931004-7.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/931004-8.c -O2 execution test +FAIL: gcc.c-torture/execute/931004-8.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/931004-8.c -O3 -g execution test +FAIL: gcc.c-torture/execute/931004-8.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/931004-8.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.c-torture/execute/931004-9.c -O2 execution test +FAIL: gcc.c-torture/execute/931004-9.c -O3 -g execution test +FAIL: gcc.c-torture/execute/931004-9.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/950322-1.c -O2 execution test +FAIL: gcc.c-torture/execute/950322-1.c -O3 -g execution test +FAIL: gcc.c-torture/execute/950322-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -O0 execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -O1 execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -O2 execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -O3 -g execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -Os execution test +FAIL: gcc.c-torture/execute/bf-pack-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/pr56866.c -O0 execution test +FAIL: gcc.c-torture/execute/pr56866.c -O1 execution test +FAIL: gcc.c-torture/execute/pr56866.c -O2 execution test +FAIL: gcc.c-torture/execute/pr56866.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/pr56866.c -O3 -g execution test +FAIL: gcc.c-torture/execute/pr56866.c -Os execution test +FAIL: gcc.c-torture/execute/pr56866.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/pr56866.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.c-torture/execute/pr82210.c -O0 execution test +FAIL: gcc.c-torture/execute/pr82210.c -O1 execution test +FAIL: gcc.c-torture/execute/pr82210.c -O2 execution test +FAIL: gcc.c-torture/execute/pr82210.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/pr82210.c -O3 -g execution test +FAIL: gcc.c-torture/execute/pr82210.c -Os execution test +FAIL: gcc.c-torture/execute/pr82210.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/pr82210.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.c-torture/execute/strct-stdarg-1.c -O2 execution test +FAIL: gcc.c-torture/execute/strct-stdarg-1.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/strct-stdarg-1.c -O3 -g execution test +FAIL: gcc.c-torture/execute/strct-stdarg-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/strct-stdarg-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.c-torture/execute/va-arg-22.c -O2 execution test +FAIL: gcc.c-torture/execute/va-arg-22.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.c-torture/execute/va-arg-22.c -O3 -g execution test +FAIL: gcc.c-torture/execute/va-arg-22.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.c-torture/execute/va-arg-22.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: tmpdir-gcc.dg-struct-layout-1/t001 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t002 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t003 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t004 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t005 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t006 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t007 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t008 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t009 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t010 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t011 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t012 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t013 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t014 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t015 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t016 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t017 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t018 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t019 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t020 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t021 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t022 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t023 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t024 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t025 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t026 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: tmpdir-gcc.dg-struct-layout-1/t028 c_compat_x_tst.o-c_compat_y_tst.o execute +FAIL: gcc.dg/pr10392-1.c execution test +FAIL: gcc.dg/strcmp-1.c execution test +FAIL: gcc.dg/strlenopt-21.c execution test +FAIL: gcc.dg/strlenopt-84.c execution test +FAIL: gcc.dg/strncmp-1.c execution test +FAIL: c-c++-common/torture/builtin-arith-overflow-16.c -O0 execution test +FAIL: c-c++-common/torture/builtin-arith-overflow-5.c -O0 execution test +FAIL: c-c++-common/torture/builtin-arith-overflow-p-16.c -O0 execution test +FAIL: c-c++-common/torture/builtin-arith-overflow-p-5.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-double.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-float.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-float32.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-float32x.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-float64.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O0 execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O1 execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O2 execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O3 -g execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -Os execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/pr100499-1.c -O1 execution test +FAIL: gcc.dg/torture/pr100499-1.c -O2 execution test +FAIL: gcc.dg/torture/pr100499-1.c -O3 -g execution test +FAIL: gcc.dg/torture/pr100499-1.c -Os execution test +FAIL: gcc.dg/torture/pr100499-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/pr100499-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/pr45764.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.dg/torture/pr45764.c -O3 -g execution test +FAIL: gcc.dg/torture/pr61346.c -O2 execution test +FAIL: gcc.dg/torture/pr61346.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.dg/torture/pr61346.c -O3 -g execution test +FAIL: gcc.dg/torture/pr61346.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/pr61346.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/pr70542.c -O0 execution test +FAIL: gcc.dg/torture/pr70542.c -O1 execution test +FAIL: gcc.dg/torture/pr70542.c -O2 execution test +FAIL: gcc.dg/torture/pr70542.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gcc.dg/torture/pr70542.c -O3 -g execution test +FAIL: gcc.dg/torture/pr70542.c -Os execution test +FAIL: gcc.dg/torture/pr70542.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/pr70542.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/torture/pr77436.c -O0 execution test +FAIL: gcc.dg/torture/pr97812.c -O0 execution test +FAIL: gcc.dg/torture/pr97812.c -O1 execution test +FAIL: gcc.dg/torture/pr97812.c -O2 execution test +FAIL: gcc.dg/torture/pr97812.c -O3 -g execution test +FAIL: gcc.dg/torture/pr97812.c -Os execution test +FAIL: gcc.dg/torture/pr97812.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/pr97812.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/tree-ssa/pr84969.c execution test and some more in the gfortran testsuite. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] xtensa: Make full transition to LRA 2023-05-10 9:10 ` [PATCH] xtensa: Make full transition to LRA Max Filippov @ 2024-01-24 5:07 ` Max Filippov 0 siblings, 0 replies; 9+ messages in thread From: Max Filippov @ 2024-01-24 5:07 UTC (permalink / raw) To: Takayuki 'January June' Suwa; +Cc: GCC Patches [-- Attachment #1: Type: text/plain, Size: 2528 bytes --] Hi Suwa-san, I've finally processed the new issues introduced by this change. On Wed, May 10, 2023 at 2:10 AM Max Filippov <jcmvbkbc@gmail.com> wrote: > On Mon, May 8, 2023 at 6:38 AM Takayuki 'January June' Suwa > <jjsuwa_sys3175@yahoo.co.jp> wrote: > > > > 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): Remove. > > --- > > 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, 14 insertions(+), 44 deletions(-) > > That's impressive. > This version introduces a few execution failures in the testsuite on > little endian targets and a bunch more (but not all, some execution > tests still pass) on big endian. > I'm traveling this week and likely won't be able to take a deep look > into it until 5/15. > > New LE failures: All of the LE failures are related to zero-overhead loops. Dropping the operand 2 from the doloop_end pattern fixes that (change 1). > New BE failures: All of the BE failures are related to loading HImode constants into registers, which instead of .literal .LCx value ... l32r register, .LCx now generates the following code: .literal .LCx value .literal .LCy .LCx ... l32r register1, .LCy l16ui register, register1, 0 I've fixed that by allowing HImode constants in the literal pool in the 'move_operand' predicate, making addresses of such constants legitimate in the xtensa_legitimate_address_p and adding an alternative with l32r opcode to the movhi_internal pattern (change 2). With these additional changes there's no new regression failures and the generated code looks mostly the same as with the reload. -- Thanks. -- Max [-- Attachment #2: 0001-gcc-xtensa-drop-operand-2-from-doloop_end-pattern.patch --] [-- Type: text/x-patch, Size: 1035 bytes --] From 0fb9ddfd22d11579674ac4a95912d2bc5612deb7 Mon Sep 17 00:00:00 2001 From: Max Filippov <jcmvbkbc@gmail.com> Date: Sun, 21 Jan 2024 16:14:20 -0800 Subject: [PATCH 1/2] gcc: xtensa: drop operand 2 from doloop_end pattern gcc/ChangeLog: * config/xtensa/xtensa.md (doloop_end): Drop operand 2. --- gcc/config/xtensa/xtensa.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 7aded86e244f..a9c37da48b81 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2368,14 +2368,12 @@ (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1))) - (unspec [(const_int 0)] UNSPEC_LSETUP_END) - (clobber (match_dup 2))])] ; match_scratch + (unspec [(const_int 0)] UNSPEC_LSETUP_END)])] "TARGET_LOOPS && optimize" { /* The loop optimizer doesn't check the predicates... */ if (GET_MODE (operands[0]) != SImode) FAIL; - operands[2] = gen_rtx_SCRATCH (SImode); }) \f -- 2.39.2 [-- Attachment #3: 0002-gcc-xtensa-fix-HImode-constant-loads.patch --] [-- Type: text/x-patch, Size: 2987 bytes --] From e5536a47e9f1ae856c2491919933d18866511991 Mon Sep 17 00:00:00 2001 From: Max Filippov <jcmvbkbc@gmail.com> Date: Tue, 23 Jan 2024 10:57:21 -0800 Subject: [PATCH 2/2] gcc: xtensa: fix HImode constant loads gcc/ChangeLog: * config/xtensa/predicates.md (move_operand): Don't check that a constant pool operand size is a multiple of UNITS_PER_WORD. * config/xtensa/xtensa.cc (xtensa_legitimate_address_p): Don't check that mode size is at least UNITS_PER_WORD. * config/xtensa/xtensa.md (movhi_internal): Add alternative loading constant from a literal pool. --- gcc/config/xtensa/predicates.md | 4 +--- gcc/config/xtensa/xtensa.cc | 2 +- gcc/config/xtensa/xtensa.md | 9 +++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md index 672fb003a6c5..dd77911e3b70 100644 --- a/gcc/config/xtensa/predicates.md +++ b/gcc/config/xtensa/predicates.md @@ -143,9 +143,7 @@ (define_predicate "move_operand" (ior (ior (match_operand 0 "register_operand") - (and (match_operand 0 "memory_operand") - (match_test "!constantpool_mem_p (op) - || GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0"))) + (match_operand 0 "memory_operand")) (ior (and (match_code "const_int") (match_test "(GET_MODE_CLASS (mode) == MODE_INT && xtensa_simm12b (INTVAL (op))) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 39ef576ac4a9..3c2d21fe8e2e 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -2343,7 +2343,7 @@ xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict, code_helper) { /* Allow constant pool addresses. */ - if (mode != BLKmode && GET_MODE_SIZE (mode) >= UNITS_PER_WORD + if (mode != BLKmode && ! TARGET_CONST16 && constantpool_address_p (addr) && ! xtensa_tls_referenced_p (addr)) return true; diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index a9c37da48b81..184b44e45f49 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1328,8 +1328,8 @@ }) (define_insn "movhi_internal" - [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,U,*a,*A") - (match_operand:HI 1 "move_operand" "M,d,r,I,Y,U,r,*A,*r"))] + [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,a,U,*a,*A") + (match_operand:HI 1 "move_operand" "M,d,r,I,Y,T,U,r,*A,*r"))] "xtensa_valid_move (HImode, operands)" "@ movi.n\t%0, %x1 @@ -1337,13 +1337,14 @@ mov\t%0, %1 movi\t%0, %x1 movi\t%0, %1 + %v1l32r\t%0, %1 %v1l16ui\t%0, %1 %v0s16i\t%1, %0 rsr\t%0, ACCLO wsr\t%1, ACCLO" - [(set_attr "type" "move,move,move,move,move,load,store,rsr,wsr") + [(set_attr "type" "move,move,move,move,move,load,load,store,rsr,wsr") (set_attr "mode" "HI") - (set_attr "length" "2,2,3,3,3,3,3,3,3")]) + (set_attr "length" "2,2,3,3,3,3,3,3,3,3")]) ;; 8-bit Integer moves -- 2.39.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] xtensa: Make full transition to LRA
@ 2024-01-24 5:15 Max Filippov
0 siblings, 0 replies; 9+ messages in thread
From: Max Filippov @ 2024-01-24 5:15 UTC (permalink / raw)
To: gcc-patches; +Cc: Takayuki 'January June' Suwa
From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
gcc/ChangeLog:
* config/xtensa/constraints.md (R, T, U):
Change define_constraint to define_memory_constraint.
* config/xtensa/predicates.md (move_operand): Don't check that a
constant pool operand size is a multiple of UNITS_PER_WORD.
* 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.
(fixup_subreg_mem): Drop function.
(xtensa_output_integer_literal_parts): Consider 16-bit wide
constants.
(xtensa_legitimate_constant_p): Add short-circuit path for
integer load instructions. Don't check that mode size is
at least UNITS_PER_WORD.
* config/xtensa/xtensa.md (movsf): Use can_create_pseudo_p()
rather reload_in_progress and reload_completed.
(doloop_end): Drop operand 2.
(movhi_internal): Add alternative loading constant from a
literal pool.
* config/xtensa/xtensa.opt (mlra): Change to no effect.
---
gcc/config/xtensa/constraints.md | 26 ++++++------------
gcc/config/xtensa/predicates.md | 4 +--
gcc/config/xtensa/xtensa.cc | 46 +++++---------------------------
gcc/config/xtensa/xtensa.md | 15 +++++------
gcc/config/xtensa/xtensa.opt | 4 +--
5 files changed, 24 insertions(+), 71 deletions(-)
diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md
index 5cade1db8ff1..dc6ffb5ba15c 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/predicates.md b/gcc/config/xtensa/predicates.md
index 672fb003a6c5..dd77911e3b70 100644
--- a/gcc/config/xtensa/predicates.md
+++ b/gcc/config/xtensa/predicates.md
@@ -143,9 +143,7 @@
(define_predicate "move_operand"
(ior
(ior (match_operand 0 "register_operand")
- (and (match_operand 0 "memory_operand")
- (match_test "!constantpool_mem_p (op)
- || GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0")))
+ (match_operand 0 "memory_operand"))
(ior (and (match_code "const_int")
(match_test "(GET_MODE_CLASS (mode) == MODE_INT
&& xtensa_simm12b (INTVAL (op)))
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index a4f8e3e49d06..22b4416f48e4 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -115,7 +115,6 @@ static enum internal_test map_test_to_internal_test (enum rtx_code);
static rtx gen_int_relational (enum rtx_code, rtx, rtx);
static rtx gen_float_relational (enum rtx_code, rtx, rtx);
static rtx gen_conditional_move (enum rtx_code, machine_mode, rtx, rtx);
-static rtx fixup_subreg_mem (rtx);
static struct machine_function * xtensa_init_machine_status (void);
static rtx xtensa_legitimize_tls_address (rtx);
static rtx xtensa_legitimize_address (rtx, rtx, machine_mode);
@@ -192,7 +191,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 +284,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
@@ -1333,35 +1328,10 @@ 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;
}
-static rtx
-fixup_subreg_mem (rtx x)
-{
- if (GET_CODE (x) == SUBREG
- && GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER)
- {
- rtx temp =
- gen_rtx_SUBREG (GET_MODE (x),
- reg_equiv_mem (REGNO (SUBREG_REG (x))),
- SUBREG_BYTE (x));
- x = alter_subreg (&temp, true);
- }
- return x;
-}
-
-
/* Check if an incoming argument in a7 is expected to be used soon and
if OPND is a register or register pair that includes a7. If so,
create a new pseudo and copy a7 into that pseudo at the very
@@ -2355,7 +2325,7 @@ xtensa_legitimate_address_p (machine_mode mode, rtx addr, bool strict,
code_helper)
{
/* Allow constant pool addresses. */
- if (mode != BLKmode && GET_MODE_SIZE (mode) >= UNITS_PER_WORD
+ if (mode != BLKmode
&& ! TARGET_CONST16 && constantpool_address_p (addr)
&& ! xtensa_tls_referenced_p (addr))
return true;
@@ -3280,7 +3250,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);
}
@@ -4952,6 +4922,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);
}
@@ -5393,12 +5367,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 20af1cbfbd03..184b44e45f49 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -1328,8 +1328,8 @@
})
(define_insn "movhi_internal"
- [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,U,*a,*A")
- (match_operand:HI 1 "move_operand" "M,d,r,I,Y,U,r,*A,*r"))]
+ [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,a,U,*a,*A")
+ (match_operand:HI 1 "move_operand" "M,d,r,I,Y,T,U,r,*A,*r"))]
"xtensa_valid_move (HImode, operands)"
"@
movi.n\t%0, %x1
@@ -1337,13 +1337,14 @@
mov\t%0, %1
movi\t%0, %x1
movi\t%0, %1
+ %v1l32r\t%0, %1
%v1l16ui\t%0, %1
%v0s16i\t%1, %0
rsr\t%0, ACCLO
wsr\t%1, ACCLO"
- [(set_attr "type" "move,move,move,move,move,load,store,rsr,wsr")
+ [(set_attr "type" "move,move,move,move,move,load,load,store,rsr,wsr")
(set_attr "mode" "HI")
- (set_attr "length" "2,2,3,3,3,3,3,3,3")])
+ (set_attr "length" "2,2,3,3,3,3,3,3,3,3")])
;; 8-bit Integer moves
@@ -1420,7 +1421,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]);
@@ -2368,14 +2369,12 @@
(set (match_dup 0)
(plus:SI (match_dup 0)
(const_int -1)))
- (unspec [(const_int 0)] UNSPEC_LSETUP_END)
- (clobber (match_dup 2))])] ; match_scratch
+ (unspec [(const_int 0)] UNSPEC_LSETUP_END)])]
"TARGET_LOOPS && optimize"
{
/* The loop optimizer doesn't check the predicates... */
if (GET_MODE (operands[0]) != SImode)
FAIL;
- operands[2] = gen_rtx_SCRATCH (SImode);
})
\f
diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt
index f16b53bf409f..19c9bd37a187 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.39.2
^ permalink raw reply [flat|nested] 9+ messages in threadend of thread, other threads:[~2025-10-20 16:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <91ddbcb5-67e2-2c30-a81e-6b20e3c8e1a4.ref@yahoo.co.jp>
2023-05-08 13:38 ` [PATCH] xtensa: Make full transition to LRA Takayuki 'January June' Suwa
2023-05-08 13:43 ` Richard Biener
2023-05-08 14:44 ` [PATCH v2] " Takayuki 'January June' Suwa
2023-05-08 22:26 ` Jeff Law
2025-10-09 21:33 ` [PATCH 3/3] xtensa: Make all memory constraints special Takayuki 'January June' Suwa
2025-10-20 16:36 ` Max Filippov
2023-05-10 9:10 ` [PATCH] xtensa: Make full transition to LRA Max Filippov
2024-01-24 5:07 ` Max Filippov
2024-01-24 5:15 [PATCH v2] " Max Filippov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).