Module Name:    src
Committed By:   rin
Date:           Sat Oct  7 11:57:56 UTC 2023

Modified Files:
        src/external/gpl3/gcc.old/dist/gcc/config/vax: vax.c

Log Message:
gcc.old: vax: PR port-vax/57646 patch provided by Kalvis Duckmanton [3/21]

Reduce expressions specifying an address of a 64 bit quantity to
a sequence of assignments to temporary variables; this allows virtual
registers to be inst antiated properly.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
    src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c
diff -u src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c:1.14 src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c:1.15
--- src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c:1.14	Sat Oct  7 11:57:27 2023
+++ src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c	Sat Oct  7 11:57:56 2023
@@ -2050,6 +2050,46 @@ vax_mode_dependent_address_p (const_rtx 
 }
 
 static rtx
+decompose_address_operand(rtx addr)
+{
+  enum rtx_code code = GET_CODE (addr);
+
+  switch (code)
+    {
+    case CONST:
+      return decompose_address_operand (XEXP (addr, 0));
+    case PLUS:
+    case MULT:
+      {
+	rtx op0, op1;
+	rtx temp;
+	/*
+	 * Generate a temporary register, assign the result of
+	 * decomposing op0 to it, then generate an op code opping (PLUS
+	 * or MULT) the result of decomposing op1 to it.
+	 * Return the temporary register.
+	 */
+	temp = gen_reg_rtx (Pmode);
+	op0 = decompose_address_operand (XEXP (addr, 0));
+	op1 = decompose_address_operand (XEXP (addr, 1));
+
+	emit_move_insn (temp, op0);
+
+	if (code == PLUS)
+	  temp = gen_rtx_PLUS (Pmode, temp, op1);
+	else if (code == MULT)
+	  temp = gen_rtx_MULT (Pmode, temp, op1);
+
+	return temp;
+      }
+      break;
+    default:
+      break;
+    }
+  return addr;
+}
+
+static rtx
 fixup_mathdi_operand (rtx x, machine_mode mode)
 {
   if (illegal_addsub_di_memory_operand (x, mode))
@@ -2064,7 +2104,7 @@ fixup_mathdi_operand (rtx x, machine_mod
 	  addr = XEXP (XEXP (addr, 0), 0);
 	}
 #endif
-      emit_move_insn (temp, addr);
+      emit_move_insn (temp, decompose_address_operand (addr));
       if (offset)
 	temp = gen_rtx_PLUS (Pmode, temp, offset);
       x = gen_rtx_MEM (DImode, temp);

Reply via email to