This is the mail archive of the
mailing list for the GCC project.
Re: volatile qualifier hurts single-threaded optimized case
On 8/30/06, Benjamin Kosnik <firstname.lastname@example.org> wrote:
> bits/atomicity.h has volatile qualifiers on the _Atomic_word* arguments to
> the __*_single and __*_dispatch variants of the atomic operations. This
> huts especially the single-threaded optimization variants which are usually
> inlined. Removing those qualifiers allows to reduce code size significantly
> as can be seen in the following simple testcase
I've been able to reproduce this with your example and the following
patch. Thanks for looking at this.
19: 00000000 546 FUNC GLOBAL DEFAULT 2 _Z3fooPKcS0_
19: 00000000 578 FUNC GLOBAL DEFAULT 2 _Z3fooPKcS0_
I don't understand the ABI objections to your suggestion, and feel like
there must be a misunderstanding somewhere. These helper functions are
not exported at all, in fact. Also, the *_dispatch and *_single parts
of the atomicity.h interface are new with 4.2, so I'd like to get the
correct signatures in with their introduction, and not have to patch
this up later.
Oh, indeed. If the *_dispatch and *_single parts are new, we can change the
function signatures there. The patch looks fine and should get us the runtime
and size improvements I saw.
Thanks for having a look!