Hello!
x86_64 has particularly interesting address mode limitations when
"high" 8bit registers (%ah, %dh, %ch and %bh) are handled. Following
examples are all valid:
movb (%rdx), %ah
addb (%rdx), %ah
but when extended register is part of a memory address, insn requires
REX prefix and assembling following examples
movb (%r8), %ah
breaks with
Error: can't encode register '%ah' in an instruction requiring REX prefix.
Due to this limitation, all binary operations involving high 8bit
registers are limited to non-memory operands on x86_64, also leading
to many differences between x86_32 and x86_64 insn descriptions (i.e.
addqi_ext_1).
A possible solution would be to use define_memory_constraint that
forces operand to BASE_REG_CLASS, which on x86_64 unfortunately also
includes REX registers. So, we currently have no way to limit reload
register to LEGACY_REG_CLASS that would elegantly solve this problem.
I have a patch that unifies all *_ext patterns in the i386.md file,
and the fixup would trigger only in one file in libgo library.
Is there some other way to limit memory address operands to
LEGACY_REG_CLASS for certain memory constraints?
Uros.