[Bug target/68908] inefficient code for an atomic preincrement on powerpc64le

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 15 04:12:00 GMT 2015


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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Interestingly, it does emit equally as efficient code as Clang for
__atomic_fetch_add:

void fetch_and_add (AI *ai)
{
    __atomic_fetch_add (ai, 1, __ATOMIC_SEQ_CST);
}

i.e.,

fetch_and_add:
        sync
.L2:
        lwarx 9,0,3
        addi 9,9,1
        stwcx. 9,0,3
        bne- 0,.L2
        isync
        blr


More information about the Gcc-bugs mailing list