Tested on hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu.  Committed
to trunk.

Dave
---

hppa: Don't canonicalize operand order of scaled index addresses

pa_print_operand handles both operand orders for scaled index
addresses, so it isn't necessary to canonicalize the order of
operands.

2024-09-09  John David Anglin  <dang...@gcc.gnu.org>

gcc/ChangeLog:

        * config/pa/pa.cc (pa_legitimate_address_p): Don't
        canonicalize operand order of scaled index addresses.

diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index 631f18a0ef5..84aa4f1b1f2 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -11022,14 +11022,13 @@ pa_legitimate_address_p (machine_mode mode, rtx x, 
bool strict, code_helper)
        return true;
 
       if (!TARGET_DISABLE_INDEXING
-         && GET_CODE (index) == MULT
          /* Only accept base operands with the REG_POINTER flag prior to
             reload on targets with non-equivalent space registers.  */
          && (TARGET_NO_SPACE_REGS
-             || (base == XEXP (x, 1)
-                 && (reload_completed
-                     || (reload_in_progress && HARD_REGISTER_P (base))
-                     || REG_POINTER (base))))
+             || reload_completed
+             || (reload_in_progress && HARD_REGISTER_P (base))
+             || REG_POINTER (base))
+         && GET_CODE (index) == MULT
          && REG_P (XEXP (index, 0))
          && GET_MODE (XEXP (index, 0)) == Pmode
          && MODE_OK_FOR_SCALED_INDEXING_P (mode)

Attachment: signature.asc
Description: PGP signature

Reply via email to