Index: doc/tm.texi
===================================================================
--- doc/tm.texi	(revision 191490)
+++ doc/tm.texi	(working copy)
@@ -5611,8 +5611,9 @@ It is not necessary for this macro to co
 address;  but often a machine-dependent strategy can generate better code.
 @end defmac
 
-@deftypefn {Target Hook} bool TARGET_MODE_DEPENDENT_ADDRESS_P (const_rtx @var{addr})
-This hook returns @code{true} if memory address @var{addr} can have
+@deftypefn {Target Hook} bool TARGET_MODE_DEPENDENT_ADDRESS_P (const_rtx @var{addr}, addr_space_t @var{addrspace})
+This hook returns @code{true} if memory address @var{addr} in address
+space @var{addrspace} can have
 different meanings depending on the machine mode of the memory
 reference it is used for or if the address is valid for some modes
 but not others.
Index: doc/tm.texi.in
===================================================================
--- doc/tm.texi.in	(revision 191490)
+++ doc/tm.texi.in	(working copy)
@@ -5536,7 +5536,8 @@ address;  but often a machine-dependent
 @end defmac
 
 @hook TARGET_MODE_DEPENDENT_ADDRESS_P
-This hook returns @code{true} if memory address @var{addr} can have
+This hook returns @code{true} if memory address @var{addr} in address
+space @var{addrspace} can have
 different meanings depending on the machine mode of the memory
 reference it is used for or if the address is valid for some modes
 but not others.
Index: target.def
===================================================================
--- target.def	(revision 191490)
+++ target.def	(working copy)
@@ -1413,7 +1413,7 @@ DEFHOOK
 DEFHOOK
 (mode_dependent_address_p,
  "",
- bool, (const_rtx addr),
+ bool, (const_rtx addr, addr_space_t addrspace),
  default_mode_dependent_address_p)
 
 /* Given an invalid address X for a given machine mode, try machine-specific
Index: recog.h
===================================================================
--- recog.h	(revision 191490)
+++ recog.h	(working copy)
@@ -114,7 +114,7 @@ extern int offsettable_address_addr_spac
 #define offsettable_address_p(strict,mode,addr) \
 	offsettable_address_addr_space_p ((strict), (mode), (addr), \
 					  ADDR_SPACE_GENERIC)
-extern bool mode_dependent_address_p (rtx);
+extern bool mode_dependent_address_p (rtx, addr_space_t);
 
 extern int recog (rtx, rtx, int *);
 #ifndef GENERATOR_FILE
Index: targhooks.h
===================================================================
--- targhooks.h	(revision 191490)
+++ targhooks.h	(working copy)
@@ -142,7 +142,7 @@ extern tree default_mangle_decl_assemble
 extern tree default_emutls_var_fields (tree, tree *);
 extern tree default_emutls_var_init (tree, tree, tree);
 extern bool default_hard_regno_scratch_ok (unsigned int);
-extern bool default_mode_dependent_address_p (const_rtx addr);
+extern bool default_mode_dependent_address_p (const_rtx, addr_space_t);
 extern bool default_target_option_valid_attribute_p (tree, tree, tree, int);
 extern bool default_target_option_pragma_parse (tree, tree);
 extern bool default_target_can_inline_p (tree, tree);
Index: combine.c
===================================================================
--- combine.c	(revision 191490)
+++ combine.c	(working copy)
@@ -5424,7 +5424,8 @@ combine_simplify_rtx (rtx x, enum machin
 	 of the address.  */
       if (MEM_P (SUBREG_REG (x))
 	  && (MEM_VOLATILE_P (SUBREG_REG (x))
-	      || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0))))
+	      || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0),
+					   MEM_ADDR_SPACE (SUBREG_REG (x)))))
 	return gen_rtx_CLOBBER (mode, const0_rtx);
 
       /* Note that we cannot do any narrowing for non-constants since
@@ -7054,7 +7055,8 @@ make_extraction (enum machine_mode mode,
 		 may not be aligned, for one thing).  */
 	      && GET_MODE_PRECISION (inner_mode) >= GET_MODE_PRECISION (tmode)
 	      && (inner_mode == tmode
-		  || (! mode_dependent_address_p (XEXP (inner, 0))
+		  || (! mode_dependent_address_p (XEXP (inner, 0),
+						  MEM_ADDR_SPACE (inner))
 		      && ! MEM_VOLATILE_P (inner))))))
     {
       /* If INNER is a MEM, make a new MEM that encompasses just the desired
@@ -7233,7 +7235,7 @@ make_extraction (enum machine_mode mode,
       /* If we have to change the mode of memory and cannot, the desired mode
 	 is EXTRACTION_MODE.  */
       if (inner_mode != wanted_inner_mode
-	  && (mode_dependent_address_p (XEXP (inner, 0))
+	  && (mode_dependent_address_p (XEXP (inner, 0), MEM_ADDR_SPACE (inner))
 	      || MEM_VOLATILE_P (inner)
 	      || pos_rtx))
 	wanted_inner_mode = extraction_mode;
@@ -7271,7 +7273,7 @@ make_extraction (enum machine_mode mode,
       && ! pos_rtx
       && GET_MODE_SIZE (wanted_inner_mode) < GET_MODE_SIZE (is_mode)
       && MEM_P (inner)
-      && ! mode_dependent_address_p (XEXP (inner, 0))
+      && ! mode_dependent_address_p (XEXP (inner, 0), MEM_ADDR_SPACE (inner))
       && ! MEM_VOLATILE_P (inner))
     {
       int offset = 0;
@@ -9883,7 +9885,8 @@ simplify_shift_const_1 (enum rtx_code co
 	     minus the width of a smaller mode, we can do this with a
 	     SIGN_EXTEND or ZERO_EXTEND from the narrower memory location.  */
 	  if ((code == ASHIFTRT || code == LSHIFTRT)
-	      && ! mode_dependent_address_p (XEXP (varop, 0))
+	      && ! mode_dependent_address_p (XEXP (varop, 0),
+					     MEM_ADDR_SPACE (varop))
 	      && ! MEM_VOLATILE_P (varop)
 	      && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count,
 					 MODE_INT, 1)) != BLKmode)
@@ -10702,7 +10705,8 @@ gen_lowpart_for_combine (enum machine_mo
 
       /* Refuse to work on a volatile memory ref or one with a mode-dependent
 	 address.  */
-      if (MEM_VOLATILE_P (x) || mode_dependent_address_p (XEXP (x, 0)))
+      if (MEM_VOLATILE_P (x)
+	  || mode_dependent_address_p (XEXP (x, 0), MEM_ADDR_SPACE (x)))
 	goto fail;
 
       /* If we want to refer to something bigger than the original memref,
Index: expr.c
===================================================================
--- expr.c	(revision 191490)
+++ expr.c	(working copy)
@@ -573,7 +573,8 @@ convert_move (rtx to, rtx from, int unsi
       if (!((MEM_P (from)
 	     && ! MEM_VOLATILE_P (from)
 	     && direct_load[(int) to_mode]
-	     && ! mode_dependent_address_p (XEXP (from, 0)))
+	     && ! mode_dependent_address_p (XEXP (from, 0),
+					    MEM_ADDR_SPACE (from)))
 	    || REG_P (from)
 	    || GET_CODE (from) == SUBREG))
 	from = force_reg (from_mode, from);
@@ -591,7 +592,8 @@ convert_move (rtx to, rtx from, int unsi
       if (!((MEM_P (from)
 	     && ! MEM_VOLATILE_P (from)
 	     && direct_load[(int) to_mode]
-	     && ! mode_dependent_address_p (XEXP (from, 0)))
+	     && ! mode_dependent_address_p (XEXP (from, 0),
+					    MEM_ADDR_SPACE (from)))
 	    || REG_P (from)
 	    || GET_CODE (from) == SUBREG))
 	from = force_reg (from_mode, from);
Index: lower-subreg.c
===================================================================
--- lower-subreg.c	(revision 191490)
+++ lower-subreg.c	(working copy)
@@ -299,7 +299,7 @@ simple_move_operand (rtx x)
 
   if (MEM_P (x)
       && (MEM_VOLATILE_P (x)
-	  || mode_dependent_address_p (XEXP (x, 0))))
+	  || mode_dependent_address_p (XEXP (x, 0), MEM_ADDR_SPACE (x))))
     return false;
 
   return true;
Index: recog.c
===================================================================
--- recog.c	(revision 191490)
+++ recog.c	(working copy)
@@ -629,7 +629,8 @@ simplify_while_replacing (rtx *loc, rtx
       if (MEM_P (XEXP (x, 0))
 	  && CONST_INT_P (XEXP (x, 1))
 	  && CONST_INT_P (XEXP (x, 2))
-	  && !mode_dependent_address_p (XEXP (XEXP (x, 0), 0))
+	  && !mode_dependent_address_p (XEXP (XEXP (x, 0), 0),
+					MEM_ADDR_SPACE (XEXP (x, 0)))
 	  && !MEM_VOLATILE_P (XEXP (x, 0)))
 	{
 	  enum machine_mode wanted_mode = VOIDmode;
@@ -1945,7 +1946,7 @@ offsettable_address_addr_space_p (int st
   /* Adjusting an offsettable address involves changing to a narrower mode.
      Make sure that's OK.  */
 
-  if (mode_dependent_address_p (y))
+  if (mode_dependent_address_p (y, as))
     return 0;
 
   /* ??? How much offset does an offsettable BLKmode reference need?
@@ -1998,11 +1999,13 @@ offsettable_address_addr_space_p (int st
 /* Return 1 if ADDR is an address-expression whose effect depends
    on the mode of the memory reference it is used in.
 
+   ADDRSPACE is the address space associated with the address.
+
    Autoincrement addressing is a typical example of mode-dependence
    because the amount of the increment depends on the mode.  */
 
 bool
-mode_dependent_address_p (rtx addr)
+mode_dependent_address_p (rtx addr, addr_space_t addrspace)
 {
   /* Auto-increment addressing with anything other than post_modify
      or pre_modify always introduces a mode dependency.  Catch such
@@ -2013,7 +2016,7 @@ mode_dependent_address_p (rtx addr)
       || GET_CODE (addr) == POST_DEC)
     return true;
 
-  return targetm.mode_dependent_address_p (addr);
+  return targetm.mode_dependent_address_p (addr, addrspace);
 }
 
 /* Like extract_insn, but save insn extracted and don't extract again, when
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c	(revision 191490)
+++ simplify-rtx.c	(working copy)
@@ -874,7 +874,7 @@ simplify_unary_operation_1 (enum rtx_cod
 	 if we are not changing the meaning of the address. */
       if (GET_CODE (op) == MEM
 	  && !MEM_VOLATILE_P (op)
-	  && !mode_dependent_address_p (XEXP (op, 0)))
+	  && !mode_dependent_address_p (XEXP (op, 0), MEM_ADDR_SPACE (op)))
 	return rtl_hooks.gen_lowpart_no_emit (mode, op);
 
       break;
@@ -5611,7 +5611,7 @@ simplify_subreg (enum machine_mode outer
      or if we would be widening it.  */
 
   if (MEM_P (op)
-      && ! mode_dependent_address_p (XEXP (op, 0))
+      && ! mode_dependent_address_p (XEXP (op, 0), MEM_ADDR_SPACE (op))
       /* Allow splitting of volatile memory references in case we don't
          have instruction to move the whole thing.  */
       && (! MEM_VOLATILE_P (op)
@@ -5769,7 +5769,8 @@ simplify_subreg (enum machine_mode outer
       && (INTVAL (XEXP (op, 1)) % GET_MODE_BITSIZE (outermode)) == 0
       && INTVAL (XEXP (op, 1)) > 0
       && INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode)
-      && ! mode_dependent_address_p (XEXP (XEXP (op, 0), 0))
+      && ! mode_dependent_address_p (XEXP (XEXP (op, 0), 0),
+				     MEM_ADDR_SPACE (XEXP (op, 0)))
       && ! MEM_VOLATILE_P (XEXP (op, 0))
       && byte == subreg_lowpart_offset (outermode, innermode)
       && (GET_MODE_SIZE (outermode) >= UNITS_PER_WORD
Index: targhooks.c
===================================================================
--- targhooks.c	(revision 191490)
+++ targhooks.c	(working copy)
@@ -1202,7 +1202,8 @@ default_hard_regno_scratch_ok (unsigned
 /* The default implementation of TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 bool
-default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED)
+default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED,
+				  addr_space_t addrspace ATTRIBUTE_UNUSED)
 {
   return false;
 }
Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 191490)
+++ config/alpha/alpha.c	(working copy)
@@ -1043,7 +1043,8 @@ alpha_legitimize_address (rtx x, rtx old
    We can simplify the test since we know that the address must be valid.  */
 
 static bool
-alpha_mode_dependent_address_p (const_rtx addr)
+alpha_mode_dependent_address_p (const_rtx addr,
+				addr_space_t as ATTRIBUTE_UNUSED)
 {
   return GET_CODE (addr) == AND;
 }
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 191490)
+++ config/sparc/sparc.c	(working copy)
@@ -567,7 +567,7 @@ static rtx sparc_legitimize_tls_address
 static rtx sparc_legitimize_pic_address (rtx, rtx);
 static rtx sparc_legitimize_address (rtx, rtx, enum machine_mode);
 static rtx sparc_delegitimize_address (rtx);
-static bool sparc_mode_dependent_address_p (const_rtx);
+static bool sparc_mode_dependent_address_p (const_rtx, addr_space_t);
 static bool sparc_pass_by_reference (cumulative_args_t,
 				     enum machine_mode, const_tree, bool);
 static void sparc_function_arg_advance (cumulative_args_t,
@@ -4045,7 +4045,8 @@ sparc_legitimize_reload_address (rtx x,
 
 
 static bool
-sparc_mode_dependent_address_p (const_rtx addr)
+sparc_mode_dependent_address_p (const_rtx addr,
+				addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (flag_pic && GET_CODE (addr) == PLUS)
     {
Index: config/m32r/m32r.c
===================================================================
--- config/m32r/m32r.c	(revision 191490)
+++ config/m32r/m32r.c	(working copy)
@@ -62,7 +62,7 @@ static void  block_move_call (rtx, rtx,
 static int   m32r_is_insn (rtx);
 static bool  m32r_legitimate_address_p (enum machine_mode, rtx, bool);
 static rtx   m32r_legitimize_address (rtx, rtx, enum machine_mode);
-static bool  m32r_mode_dependent_address_p (const_rtx);
+static bool  m32r_mode_dependent_address_p (const_rtx, addr_space_t);
 static tree  m32r_handle_model_attribute (tree *, tree, tree, int, bool *);
 static void  m32r_print_operand (FILE *, rtx, int);
 static void  m32r_print_operand_address (FILE *, rtx);
@@ -2011,7 +2011,7 @@ m32r_legitimize_address (rtx x, rtx orig
 /* Worker function for TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-m32r_mode_dependent_address_p (const_rtx addr)
+m32r_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == LO_SUM)
     return true;
Index: config/rx/rx.c
===================================================================
--- config/rx/rx.c	(revision 191490)
+++ config/rx/rx.c	(working copy)
@@ -318,7 +318,7 @@ rx_is_restricted_memory_address (rtx mem
 /* Implement TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-rx_mode_dependent_address_p (const_rtx addr)
+rx_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == CONST)
     addr = XEXP (addr, 0);
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 191490)
+++ config/avr/avr.c	(working copy)
@@ -1632,7 +1632,7 @@ avr_cannot_modify_jumps_p (void)
       with mov<mode> expanders in avr.md.  */
 
 static bool
-avr_mode_dependent_address_p (const_rtx addr)
+avr_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   return GET_MODE (addr) != Pmode;
 }
Index: config/xtensa/xtensa.c
===================================================================
--- config/xtensa/xtensa.c	(revision 191490)
+++ config/xtensa/xtensa.c	(working copy)
@@ -126,7 +126,7 @@ 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, enum machine_mode);
-static bool xtensa_mode_dependent_address_p (const_rtx);
+static bool xtensa_mode_dependent_address_p (const_rtx, addr_space_t);
 static bool xtensa_return_in_msb (const_tree);
 static void printx (FILE *, signed int);
 static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -1961,7 +1961,8 @@ xtensa_legitimize_address (rtx x,
    by default.  */
 
 static bool
-xtensa_mode_dependent_address_p (const_rtx addr)
+xtensa_mode_dependent_address_p (const_rtx addr,
+				 addr_space_t as ATTRIBUTE_UNUSED)
 {
   return constantpool_address_p (addr);
 }
Index: config/stormy16/stormy16.c
===================================================================
--- config/stormy16/stormy16.c	(revision 191490)
+++ config/stormy16/stormy16.c	(working copy)
@@ -671,7 +671,8 @@ xstormy16_legitimate_address_p (enum mac
    or pre-decrement address.  */
 
 static bool
-xstormy16_mode_dependent_address_p (const_rtx x)
+xstormy16_mode_dependent_address_p (const_rtx x,
+				    addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (LEGITIMATE_ADDRESS_CONST_INT_P (x, 0)
       && ! LEGITIMATE_ADDRESS_CONST_INT_P (x, 6))
Index: config/m68k/m68k.md
===================================================================
--- config/m68k/m68k.md	(revision 191490)
+++ config/m68k/m68k.md	(working copy)
@@ -5610,7 +5610,8 @@ (define_insn ""
 	(match_operand:SI 2 "general_src_operand" "rmSi"))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[1]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[0], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[0], 0),
+                                  MEM_ADDR_SPACE (operands[0]))"
 {
   operands[0]
     = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
@@ -5627,7 +5628,8 @@ (define_insn ""
    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
    && (GET_CODE (operands[0]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[0], 0),
+                                      MEM_ADDR_SPACE (operands[0])))"
 {
   if (REG_P (operands[0]))
     {
@@ -5664,7 +5666,8 @@ (define_insn ""
 			 (match_operand:SI 2 "const_int_operand" "n")))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[2]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[1], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                  MEM_ADDR_SPACE (operands[1]))"
 {
   operands[1]
     = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
@@ -5681,7 +5684,8 @@ (define_insn ""
    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (GET_CODE (operands[1]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1])))"
 {
   cc_status.flags |= CC_NOT_NEGATIVE;
   if (REG_P (operands[1]))
@@ -5718,7 +5722,8 @@ (define_insn ""
 			 (match_operand:SI 2 "const_int_operand" "n")))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[2]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[1], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                  MEM_ADDR_SPACE (operands[1]))"
 {
   operands[1]
     = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
@@ -5735,7 +5740,8 @@ (define_insn ""
    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (GET_CODE (operands[1]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1])))"
 {
   if (REG_P (operands[1]))
     {
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 191490)
+++ config/rs6000/rs6000.c	(working copy)
@@ -6463,7 +6463,8 @@ rs6000_debug_legitimate_address_p (enum
 /* Implement TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-rs6000_mode_dependent_address_p (const_rtx addr)
+rs6000_mode_dependent_address_p (const_rtx addr,
+				 addr_space_t as ATTRIBUTE_UNUSED)
 {
   return rs6000_mode_dependent_address_ptr (addr);
 }
Index: config/vax/vax.c
===================================================================
--- config/vax/vax.c	(revision 191490)
+++ config/vax/vax.c	(working copy)
@@ -64,7 +64,7 @@ static rtx vax_builtin_setjmp_frame_valu
 static void vax_asm_trampoline_template (FILE *);
 static void vax_trampoline_init (rtx, tree, rtx);
 static int vax_return_pops_args (tree, tree, int);
-static bool vax_mode_dependent_address_p (const_rtx);
+static bool vax_mode_dependent_address_p (const_rtx, addr_space_t);
 
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -1839,7 +1839,7 @@ vax_legitimate_address_p (enum machine_m
    thus (because the index scale factor is the length of the operand).  */
 
 static bool
-vax_mode_dependent_address_p (const_rtx x)
+vax_mode_dependent_address_p (const_rtx x, addr_space_t as ATTRIBUTE_UNUSED)
 {
   rtx xfoo0, xfoo1;
 
Index: config/vax/predicates.md
===================================================================
--- config/vax/predicates.md	(revision 191490)
+++ config/vax/predicates.md	(working copy)
@@ -79,9 +79,9 @@ (define_predicate "indirect_memory_opera
 (define_predicate "indexed_memory_operand"
    (match_code "mem")
 {
-  op = XEXP (op, 0);
-  return GET_CODE (op) != PRE_DEC && GET_CODE (op) != POST_INC
-	 && mode_dependent_address_p (op);
+  rtx addr = XEXP (op, 0);
+  return GET_CODE (addr) != PRE_DEC && GET_CODE (addr) != POST_INC
+	 && mode_dependent_address_p (addr, MEM_ADDR_SPACE (op));
 })
 
 (define_predicate "illegal_blk_memory_operand"
Index: config/vax/vax.md
===================================================================
--- config/vax/vax.md	(revision 191490)
+++ config/vax/vax.md	(working copy)
@@ -782,7 +782,8 @@ (define_insn ""
    "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
    && (REG_P (operands[0])
-       || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[0], 0),
+				       MEM_ADDR_SPACE (operands[0])))"
   "*
 {
   if (REG_P (operands[0]))
@@ -810,7 +811,8 @@ (define_insn ""
   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (REG_P (operands[1])
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+				      MEM_ADDR_SPACE (operands[1])))"
   "*
 {
   if (REG_P (operands[1]))
@@ -837,7 +839,8 @@ (define_insn ""
   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (REG_P (operands[1])
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+				      MEM_ADDR_SPACE (operands[1])))"
   "*
 {
   if (REG_P (operands[1]))
@@ -960,7 +963,8 @@ (define_insn "extv"
       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
       || side_effects_p (operands[1])
       || (MEM_P (operands[1])
-	  && mode_dependent_address_p (XEXP (operands[1], 0))))
+	  && mode_dependent_address_p (XEXP (operands[1], 0),
+				       MEM_ADDR_SPACE (operands[1]))))
     return \"extv %3,%2,%1,%0\";
   if (INTVAL (operands[2]) == 8)
     return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
@@ -988,7 +992,8 @@ (define_insn ""
       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
       || side_effects_p (operands[1])
       || (MEM_P (operands[1])
-	  && mode_dependent_address_p (XEXP (operands[1], 0))))
+	  && mode_dependent_address_p (XEXP (operands[1], 0),
+				       MEM_ADDR_SPACE (operands[1]))))
     return \"extzv %3,%2,%1,%0\";
   if (INTVAL (operands[2]) == 8)
     return \"rotl %R3,%1,%0\;movzbl %0,%0\";
Index: config/vax/constraints.md
===================================================================
--- config/vax/constraints.md	(revision 191490)
+++ config/vax/constraints.md	(working copy)
@@ -99,7 +99,8 @@ (define_constraint "G"
 (define_memory_constraint "Q"
    "operand is a MEM that does not have a mode-dependent address."
    (and (match_code "mem")
-	(match_test "!mode_dependent_address_p (XEXP (op, 0))")))
+	(match_test "!mode_dependent_address_p (XEXP (op, 0),
+					        MEM_ADDR_SPACE (op))")))
 
 (define_memory_constraint "B"
     ""
Index: config/h8300/h8300.c
===================================================================
--- config/h8300/h8300.c	(revision 191490)
+++ config/h8300/h8300.c	(working copy)
@@ -2166,7 +2166,8 @@ h8300_get_index (rtx x, enum machine_mod
    (the amount of decrement or increment being the length of the operand).  */
 
 static bool
-h8300_mode_dependent_address_p (const_rtx addr)
+h8300_mode_dependent_address_p (const_rtx addr,
+				addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == PLUS
       && h8300_get_index (XEXP (addr, 0), VOIDmode, 0) != XEXP (addr, 0))
