In expmed.c I see code like this: if (REG_P (xop0) && GET_MODE (xop0) != op_mode) xop0 = gen_rtx_SUBREG (op_mode, xop0, 0);
However, this is wrong for big-endian targets (h8300-elf in my case) because '0' is not the offset of the LSB of the register when it's a pseudo and op_mode is smaller than xop0's mode. IIRC simplify_subreg does endian adjustments where gen_rtx_SUBREG does not, however, simplify_subreg may return NULL_RTX. What's the "right thing" to do here, these days? I've temporarily put in a function to special case the failing case, but it seems... inelegant. Is there a missing assumption somewhere?