> switch (which_alternative) {
> case 0: /* register to register */
Better to just use the @ syntax that gcc offers, to provide multiple
patterns:
"@
tfr %0,%1
ldih %0, hi(%1); ldil %0, lo(%1)
ldih %0, hi(%1); ldil %0, lo(%1)
st %1,(%0)
ld %0,(%1)"
Everything else should have been sorted out by the constraints.
> This seems to work ok, but I still have issues at reload time, because
> of the base register addressing mode: in the reload pass gcc generates
> moves from/to the stack:
You might need to define LEGITIMIZE_RELOAD_ADDRESS, or at least
LEGITIMIZE_ADDRESS. I don't know if reload has assumptions about such
offsets, but the m32c port has a limit on the offset range so it might
help you figure out your port.