>   The problem appears to be that GCC will create a multiply-plus-add
>   instruction to access the table regardless of whether the backend
>   supports such an instruction.  I could not work out where in the
>   middle end this was occurring, so instead I created the patch below
>   which contains a splitter to separate out the multiply and addition
>   operations.

I've seen this before.  The root of the problem is in
expand_expr_real_1() where convert_to_mode() is called (around line
10262 in my tree) to change the address's mode from HImode to SImode,
but this happens *before* the address itself is legitimized (I think).
So we have an invalid address causing the problem, at a point were we
don't care if the address is valid or not.

Either the address must be legitimized before that point, or some
other conversion needs to be used.  Either way, I think adding a
pattern for this particular address is only hiding the problem, not
fixing it.

        if (offset)
          {
            machine_mode address_mode;
            rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode,
                                          EXPAND_SUM);

            gcc_assert (MEM_P (op0));

            address_mode = get_address_mode (op0);
            if (GET_MODE (offset_rtx) != address_mode)
-->           offset_rtx = convert_to_mode (address_mode, offset_rtx, 0);

Reply via email to