Re: GCC in-line assembly and the removal of -mcx16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/05/17 11:53, Alexander Monakov wrote:
> 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

I may well be completely wrongly - GCC is complex, building it is
complex, and I'm a stranger to the development process and how it is
documented and released, but I built 7.1.0 on x86_64, tried to compile
and link a test programme with it, and failed with;

"undefined reference to `__atomic_compare_exchange_16'".

Changing to 6.2.0 (built using a script, and so built identically to
7.1.0) fixed the problem.

I filed a bug for it;

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878

And although the reply is hardly canonical, it does for what it's worth
seem to indicate that the switch has gone away.

However, the 7.1.0 docs still list the switch (search for "-mcx16");

https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html#x86-Options

If you are using 7.1.0 and you have that output, can I ask how you built
or obtained your compiler?




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux