On Wed, Jul 13, 2011 at 9:54 AM, Paolo Bonzini wrote: >>>> Why?  Certainly Y = 8 has 31-bit (or less) precision.  So it has the same >>>> representation in SImode and DImode, and the test above on XEXP (x, 1) >>>> succeeds. >>> >>> And then we permute conversion and addition, which leads to the issue you >>> raised above.  In another word, the current code permutes conversion >>> and addition. >> >> No, only if we have ptr_extend. > > Oops, hit send too early, I understand now what you mean.  But even > more so, let's make sure x32 is done right so that perhaps we can > remove the bogus test on XEXP (x, 1) for other Pmode != ptr_mode > targets, non-ptr_extend.  Then we can worry perhaps of > POINTERS_EXTEND_UNSIGNED < 0. > Here is the patch. OK for trunk? Thanks. -- H.J. ---- 2011-07-12 H.J. Lu PR middle-end/49721 * explow.c (convert_memory_address_addr_space_1): New. (convert_memory_address_addr_space): Use it. * expr.c (convert_modes_1): New. (convert_modes): Use it. * expr.h (convert_modes_1): New. * rtl.h (convert_memory_address_addr_space_1): New. (convert_memory_address_1): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Call convert_memory_address_1 instead of convert_memory_address.