GCC in-line assembly and the removal of -mcx16

Alexander Monakov amonakov@ispras.ru
Fri May 26 09:53:00 GMT 2017


On Fri, 26 May 2017, Toebs Douglass wrote:

> Hej all.
> 
> In GCC 7.1.0, the x86_64 specific option "-mcx16" has been removed.
> 
> This means that the atomic intrinsics will no longer emit cmpxchg16b,
> the double-word CAS instruction.

Huh, where did you read that? This is not true, neither the option has been
removed, nor the capability to emit the instruction: for example, compiling

void f(__int128 *p)
{
    __sync_val_compare_and_swap(p, 0, 0);
}

with 'gcc -mcx16 -O2' produces

f:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        xorl    %ecx, %ecx
        xorl    %eax, %eax
        xorl    %edx, %edx
        movq    %rcx, %rbx
        lock cmpxchg16b (%rdi)
        popq    %rbx
        .cfi_def_cfa_offset 8
        ret

Alexander



More information about the Gcc-help mailing list