FR: Support register parameter names in memory references in AT&T assembly syntax.
See this topic. With Intel syntax, I can do the following:
{$asmmode intel}
procedure SetMiddleTo5(p: pointer; n: SizeUint); assembler; nostackframe;
asm
shr n, 1 // becomes “shr rdx, 1” (Win64) or “shr rsi, 1” (System V)
mov byte ptr [p + n], 5 // becomes “mov byte ptr [rcx + rdx], 5” (Win64) or “mov byte ptr [rdi + rsi], 5” (System V)
end;
Which often allows writing cross-ABI code without a single {$ifdef}
or with less {$ifdef}
s. In particular, it would allow to get rid of runtime adapters between ABIs ({$ifndef win64} mov %rdx, %r8; ... {$endif}
) in this file without any, or much, clutter.
However, AT&T syntax does not seem to support parameter names in memory references:
{$asmmode att}
procedure SetMiddleTo5(p: pointer; n: SizeUint); assembler; nostackframe;
asm
shrq $1, n // becomes “shrq $1, %rdx” (Win64) or “shrq $1, %rsi” (System V)
movb $5, (p,n) // Invalid reference syntax.
end;