LEGITIMIZE_RELOAD_ADDRESS (was PowerPC illegal displacement generation )

David Edelsohn dje@watson.ibm.com
Thu Jan 21 12:14:00 GMT 1999


	The illegal displacements are being manufactured by
LEGITIMIZE_RELOAD_ADDRESS macro called from
reload.c:find_reloads_address(). 

Before the macro:

(plus:SI (reg:SI 31 r31)
    (const_int 40128))

After the macro:

(plus:SI (plus:SI (reg:SI 31 r31)
        (const_int 65536))
    (const_int -25408))

The macro is the same as on Alpha and calculates:

      HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;           \
      HOST_WIDE_INT high                                                \
        = (((val - low) & 0xffffffff) ^ 0x80000000) - 0x80000000;       \
      X = gen_rtx_PLUS (GET_MODE (X),                                   \
                        gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0),        \
                                      GEN_INT (high)),                  \
                        GEN_INT (low));                                 \

For 40128, the macro decomposes this into high = 65536 and low = -25408.

	Alpha uses signed displacements as well.  I cannot believe that it
allows 65536 as an offset either.

Should the order of the summation be in the opposire order so that the
displacement for the load is the low address and the base register is the
high address?

Or is there something different about the way the backend split the sums
for PowerPC than for Alpha, using the high value as the displacement?

Thanks, David



More information about the Gcc-bugs mailing list