Bug 46031 - Atomic Builtins page should indicate that 16-byte compare-and-swap is available with -mcex16
Summary: Atomic Builtins page should indicate that 16-byte compare-and-swap is availab...
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: documentation
Depends on:
Reported: 2010-10-15 05:02 UTC by Justin Lebar
Modified: 2012-01-28 04:37 UTC (History)
0 users

See Also:
Target: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lebar 2010-10-15 05:02:58 UTC
The atomic builtins page doesn't indicate that gcc supports 16-byte compare-and-swap instructions.  But gcc does in fact support this instruction, so the page should indicate that the functionality can be enabled with -mcex16 (or, presumably, with the appropriate -march flag).

Comment 1 Andrew Pinski 2010-10-15 05:08:00 UTC
I don't think the atomics page should reference a target specific option. 

I think the following sentence makes that clear that the builtins are dependent on target options as they can change what the target processor is:
Not all operations are supported by all target processors.
Comment 2 Justin Lebar 2010-10-15 05:30:20 UTC
"Not all operations are supported by all target processors" isn't the same as "not all operations supported by target processors are listed here."

If you want to be vague and say "some target processors support other operations or other operand sizes, not listed here", I guess that would be an improvement.  But from a user's perspective, I'd like the manual to tell me which builtins GCC supports, and under which circumstances those operations are available.  In this case, the manual's omission of 16-bit cex suggested to me that gcc didn't support it at all.
Comment 3 Andrew Pinski 2010-10-15 05:39:53 UTC
Actually it says the target processors might not include all of the builtins.  What is a target processor is up to each target and likewise on how to change the processor.

This should allow you to read the target options for how to change the processor GCC is targeting.  This is the same issue as -march=i386 does not support any of them vs -march=i686 supports the majority of them.

The x86 specific options explicitly references the atomic builtins.  Again I don't think we should reference target specific options in the generic part of the manual.  Doing that makes the manual even more confusing.  Maybe adding the following sentence will help:
Each target defines how a specific processor is selected, see the target options pages on how to select the specific processor.
Comment 4 Justin Lebar 2010-10-15 05:54:28 UTC
> Actually it says the target processors might not include all of the builtins.

Maybe I'm not making sense.  My point is that there's a builtin (*) that is supported by some target processors but is not listed in the manual.  So the statement that some target processors might not include all the builtins isn't helpful.

* The builtin is compare_and_swap with 16-byte operands.  The manual explicitly says "GCC will allow any integral scalar or pointer type that is 1, 2, 4 or 8 bytes in length" but should indicate that 16-byte operands are supported for compare_and_swap, at least under some circumstances.