On 12/15/2015 01:42 PM, paul_kon...@dell.com wrote:
On Dec 15, 2015, at 7:52 AM, Bernd Schmidt <bschm...@redhat.com>
wrote:
On 12/14/2015 09:10 AM, Segher Boessenkool wrote:
That, and adding a memory clobber degrades performance for a lot
of existing basic asm that does not expect the clobber, e.g.
asm(""), asm("#"), asm("nop"), ...
I wonder about this. People keep bringing up "a lot of existing
basic asm" in general, but are there any known examples in real
software?
In the codebase for the product I work on, I see about 200 of them.
Many of those are the likes of asm("sync") for MIPS, which definitely
wants to be treated as if it were asm ("sync" : : : "memory").
Precisely. And it's these kind that are subject to "oh, surprise,
gcc-new does some new optimization of loads/stores and your previously
working code now fails miserably". Oh, and good luck finding it, these
kinds of things are notoriously tough to track down.
And that is bad on so many levels.
The only sensible way forward is to treat them like memory barriers.
That's what is expected and that is what we should be doing. The fact
that we haven't done it is simply a bug.
The fact that someone might lose the ability to do memory optimizations
across asm ("") or asm ("#") or asm ("nop") is not reason to keep the
status quo.
Sadly, I'm putting most of this discussion into my gcc-7 queue anyway.
Jeff