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

--- Comment #7 from Jim Wilson <wilson at gcc dot gnu.org> ---
(In reply to Luís Marques from comment #3)
> Jim Wilson: I'm not using it, I was only working on the LLVM implementation.
> Could you please clarify if following modifiers are also internal only?
> 
>   'C'  Print the integer branch condition for comparison OP.
>   'A'  Print the atomic operation suffix for memory model OP.
>   'F'  Print a FENCE if the memory model requires a release.

'C' maps an rtx to a string.  It is intended to be used for comparisons to emit
the appropriate compare instruction, because the instruction names match the
gcc internal rtx names.  It can't be used for its intended purpose in an asm,
as you can't get a comparison operator as an operand to an asm.  Since it works
with any rtx, it can be used in an asm, but is very unlikely to be useful.

'A' takes a memory order value from stdatomic.h, and emits a .acq if it is one
of the memory orders that requires an acquire operation, e.g. __ATOMIC_ACQUIRE.
 Gcc calls this a memory model internally, and defines the values in
memmodel.h.  The primary use is for the atomic builtin functions, to map the
memory order argument to the right instruction.  This takes an integer
argument, so in theory it could be used in an asm, but unlikely to be very
useful.

'F" is similar, except it is to atomic releases, and emits a fence instruction.
 This one is a bit of historical accident.  The gcc riscv port was written
before we had a formal memory model defined, and so to be conservative, it
emits fences in a lot of places where we probably don't need them.  Now that we
do have a formal memory model defined, the gcc port needs to be fixed to
implement it, except there is no one to do the work, so it is unclear when it
will happen.  Meanwhile, the port still emits a lot of fences we don't need via
'F'.  This takes an integer argument as above, so likewise in theory could be
used in an asm, but unlikely to be useful.  And this one has the additional
problem that it needs to change in a future gcc release, though we could
preserve the current meaning of the 'F' letter and use a new letter if
necessary in the rewrite.

The useful print operand letters are the ones for registers, constants, and
addresses.  These random ones used for internal gcc features aren't really
useful in asms.

Reply via email to