GCC in-line assembly and the removal of -mcx16

Toebs Douglass toby@winterflaw.net
Fri May 26 20:41:00 GMT 2017


On 26/05/17 22:32, Alexander Monakov wrote:
> On Fri, 26 May 2017, Toebs Douglass wrote:
>>> Just as a note to any future readers, although I may well be wrong, I
>>> think this is only true for GCC 4.8.0 onwards, with the introduction of
>>> the 128 bit types.
> 
> (4.6 actually)

Yes.  I mixed 4.6 up in my head with 4.8, probably because I've been
thinking about 4.8 recently (aarch64).

>> I *think* -mcx16 was introduced in 4.3.0.
>>
>> Why would it *be* introduced here if GCC could not use it?
>>
>> Was there then another way to indicate to the __sync functions they were
>> being given a 128-bit type?
> 
> The intended way was via a typedef:
> 
>     typedef int my_int128 __attribute__((mode(TI)));

Gosh.  I never knew - I did at least some looking at one point many
years into using 128-bit variable with __sync.

Hmm.  I think I could use that to remove the in-line assembly I have for
cmpxchg16b, for versions 4.3 to 4.6.

> And it appears there's another, undocumented (and thus unsupported afaict) way,
> via suffixing object size to the builtin name:  __sync_val_compare_and_swap_16.

Even further away from my knowledge, probably for the best in this case
though :-)

Thankyou again, Alex!  invaluable.




More information about the Gcc-help mailing list