On Mon, Mar 21, 2011 at 9:05 AM, Richard Sandiford <richard.sandif...@linaro.org> wrote: > "H.J. Lu" <hongjiu...@intel.com> writes: >> diff --git a/gcc/explow.c b/gcc/explow.c >> index 460af1f..9b3c082 100644 >> --- a/gcc/explow.c >> +++ b/gcc/explow.c >> @@ -611,6 +611,8 @@ copy_to_reg (rtx x) >> rtx >> copy_addr_to_reg (rtx x) >> { >> + if (GET_MODE (x) != VOIDmode && GET_MODE (x) != Pmode) >> + x = convert_to_mode (Pmode, x, 1); >> return copy_to_mode_reg (Pmode, x); >> } > > I think you need to say why the conversion should be done here > rather than in the caller. > > Regardless of that, though: I think this should be convert_memory_address > rather than convert_to_mode. Paasing 1 is wrong, because pointers are > signed on some targets. > > Richard >
I checked in this patch instead. -- H.J. --- commit be4544a925b433d8638be0ca42d2156ceb23cad9 Author: H.J. Lu <hjl.to...@gmail.com> Date: Mon Mar 21 09:52:00 2011 -0700 Call convert_memory_address in ix86_expand_builtin. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index 86e4425..fa9d384 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,6 +1,12 @@ 2011-03-21 H.J. Lu <hongjiu...@intel.com> PR target/48084 + * config/i386/i386.c (ix86_expand_builtin): Call + convert_memory_address. + +2011-03-21 H.J. Lu <hongjiu...@intel.com> + + PR target/48084 * explow.c (copy_addr_to_reg): Don't convert to Pmode here. 2011-03-17 H.J. Lu <hongjiu...@intel.com> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 73ce73a..4ac335f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -27790,7 +27790,10 @@ rdrand_step: arg0 = CALL_EXPR_ARG (exp, 0); op1 = expand_normal (arg0); if (!address_operand (op1, VOIDmode)) - op1 = copy_addr_to_reg (op1); + { + op1 = convert_memory_address (Pmode, op1); + op1 = copy_addr_to_reg (op1); + } emit_move_insn (gen_rtx_MEM (mode0, op1), op0); return target;