diff --git a/external/gpl3/gcc/dist/gcc/config/vax/vax.c b/external/gpl3/gcc/dist/gcc/config/vax/vax.c
index 1621aa56b57b..12024604793b 100644
--- a/external/gpl3/gcc/dist/gcc/config/vax/vax.c
+++ b/external/gpl3/gcc/dist/gcc/config/vax/vax.c
@@ -2047,6 +2047,50 @@ vax_mode_dependent_address_p (const_rtx x, addr_space_t as ATTRIBUTE_UNUSED)
 }
 
 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))
@@ -2061,7 +2105,7 @@ fixup_mathdi_operand (rtx x, machine_mode mode)
 	  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);
