How to specify register constraints on the Intel x86_64 register r8 to r15 in GCC inline assembly?

前端 未结 2 1015
傲寒
傲寒 2020-12-11 00:38

Here\'s the list of register loading codes:

a eax
b ebx
c ecx
d edx
S esi
D ed

2条回答
  •  难免孤独
    2020-12-11 01:21

    The machine specific constraints have a section in the gcc manual - the ugly details are found in config/i386/constraints.md.

    Some constraints have different meanings for x86-64, e.g., q is %eax,%ebx,%ecx,%edx in 32-bit mode; in 64-bit mode, it's any general purpose integer register - and essentially the same as the r constraint. Specific registers names like a now refer to %rax, d to %rdx, etc.

    There are, however, no special constraints or names for %r8 .. %r15. There's an excellent (x86-64 specific) tutorial on inline assembly and constraint use here.

提交回复
热议问题