http://llvm.org/bugs/show_bug.cgi?id=15429

Abdoulaye Walsimou GAYE <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #18 from Abdoulaye Walsimou GAYE <[email protected]> ---
This fix does not allow atomic operations for pre v6 devices, as GCC does.

Attched, proposed improvement patch for ARM devices older than v6.
GCC supports up to 4 bytes atomic operations, through libgcc, for devices older
than v6.

Compile and runtime tested on arm926ej-s(armv5te) with various uint{x}_t with
the following code:

#include <stdio.h>
#include <stdint.h>
typedef uint32_t _Atomic_word;

_Atomic_word exchange_and_add(volatile _Atomic_word *__mem, _Atomic_word __val)
{
    return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL);
}
int main()
{
    _Atomic_word test = 40;
    _Atomic_word ret;
    _Atomic_word val = 10;

    ret = exchange_and_add(&test, val);
    printf("RET = %u\n", test);

    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to