if (code == ALIGN_INDIRECT_REF)
{
int align = TYPE_ALIGN_UNIT (type);
op0 = gen_rtx_AND (address_mode, op0, GEN_INT (-align));
op0 = memory_address_addr_space (mode, op0, as);
}
we seem to rely on combine or whatever to do fancy things
No, the AND is getting into the expansion directly if it is a legitimate
address.
Which is a hack, right? With the plan I have in mind we'd have
ptr&= 3; // align the pointer
.. = *p; // aligned load
which should expand fine (to an AND and to an aligned load). Then
combine can combine those two insns just fine to the aligning load.