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

Dave
---

hppa: Fix LO_SUM DLTIND14R address support in PRINT_OPERAND_ADDRESS 

This bug was hidden since LO_SUM DLTIND14R addresses are normally
handled by the A constraint in the move patterns.

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

gcc/ChangeLog:

        * config/pa/pa.cc (pa_output_global_address): Handle
        UNSPEC_DLTIND14R addresses.
        * config/pa/pa.h (PRINT_OPERAND_ADDRESS): Output "RT'" for
        UNSPEC_DLTIND14R address.

diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index d7666103de8..f9b1906efb4 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -5784,7 +5784,12 @@ pa_output_global_address (FILE *file, rtx x, int 
round_constant)
   if (GET_CODE (x) == HIGH)
     x = XEXP (x, 0);
 
-  if (GET_CODE (x) == SYMBOL_REF && read_only_operand (x, VOIDmode))
+  if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_DLTIND14R)
+    {
+      x = XVECEXP (x, 0, 0);
+      output_addr_const (file, x);
+    }
+  else if (GET_CODE (x) == SYMBOL_REF && read_only_operand (x, VOIDmode))
     output_addr_const (file, x);
   else if (GET_CODE (x) == SYMBOL_REF && !flag_pic)
     {
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 403f16c5cb5..127a0d1966d 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1247,12 +1247,15 @@ do {                                                    
                     \
               reg_names [REGNO (XEXP (addr, 0))]);                     \
       break;                                                           \
     case LO_SUM:                                                       \
-      if (!symbolic_operand (XEXP (addr, 1), VOIDmode))                        
\
+      if (GET_CODE (XEXP (addr, 1)) == UNSPEC                          \
+         && XINT (XEXP (addr, 1), 1) == UNSPEC_DLTIND14R)              \
+       fputs ("RT'", FILE);                                            \
+      else if (!symbolic_operand (XEXP (addr, 1), VOIDmode))           \
        fputs ("R'", FILE);                                             \
       else if (flag_pic == 0)                                          \
        fputs ("RR'", FILE);                                            \
       else                                                             \
-       fputs ("RT'", FILE);                                            \
+       gcc_unreachable ();                                             \
       pa_output_global_address (FILE, XEXP (addr, 1), 0);              \
       fputs ("(", FILE);                                               \
       output_operand (XEXP (addr, 0), 0);                              \

Attachment: signature.asc
Description: PGP signature

Reply via email to