Matt Godbolt <m...@godbolt.org> writes:
> GCC's code generation uses a "load; add; store" for volatiles, instead
> of a single "add 1, [metric]".

GCC doesn't know if a target's load/add/store patterns are
volatile-safe, so it must avoid them.  There are a few targets that have
been audited for volatile-safe-ness such that gcc *can* use the combined
load/add/store when the backend says it's OK.  x86 is not yet one of
those targets.

Also, note that the standard says the physical target must do the same
operations that the "model" target does, but it does not require that
these operations be in separate opcodes.  A single opcode that performs
the correct operations in the correct order complies with the standard;
but you have to tell gcc which opcodes comply.

Reply via email to