AnsweredAssumed Answered

Atomic compare exchange for SHARC SC589

Question asked by tcmichals on Sep 6, 2016
Latest reply on Jul 3, 2017 by habanero

I'm looking for support for atomic memory operations for the SC589/SHARC+ processor for the following functions:

i.e

atomic_decrementt( int * pw, int incr ); 

 

    __asm
    {
        mov eax, incr
        mov esi, [pw]
        lock sub dword ptr [esi], eax
    }

atomic_compare_and_exchange( int * pw, int equals, int setto);

    __asm
    {
        mov eax, equals
        mov edi, setto
        mov esi, [pw]
        lock cmpxchg dword ptr [esi], edi
    }

 

In x86, there is a a lock instruction, does this exist in SHARC+? i.e

Outcomes