* switch PowerPC 32 RTL to provide atomic intrinsic helpers instead of Interlocked* functions

This commit is contained in:
Sven/Sarah Barth 2024-12-07 22:24:25 +01:00
parent 5a6f7b3e29
commit fdd0ebeed9

View File

@ -1103,7 +1103,17 @@ asm
end;
{$ifndef VER3_2}
{$define FPC_SYSTEM_INTERLOCKED_USE_INTRIN}
{$endif VER3_2}
{$ifdef VER3_2}
function InterLockedDecrement (var Target: longint) : longint; assembler; nostackframe;
{$else VER3_2}
{$define FPC_SYSTEM_HAS_ATOMIC_DEC_32}
function fpc_atomic_dec_32 (var Target: longint) : longint; assembler; nostackframe;
{$endif VER3_2}
{ input: address of target in r3 }
{ output: target-1 in r3 }
{ side-effect: target := target-1 }
@ -1117,7 +1127,12 @@ asm
end;
{$ifdef VER3_2}
function InterLockedIncrement (var Target: longint) : longint; assembler; nostackframe;
{$else VER3_2}
{$define FPC_SYSTEM_HAS_ATOMIC_INC_32}
function fpc_atomic_inc_32 (var Target: longint) : longint; assembler; nostackframe;
{$endif VER3_2}
{ input: address of target in r3 }
{ output: target+1 in r3 }
{ side-effect: target := target+1 }
@ -1131,7 +1146,12 @@ asm
end;
{$ifdef VER3_2}
function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler; nostackframe;
{$else VER3_2}
{$define FPC_SYSTEM_HAS_ATOMIC_XCHG_32}
function fpc_atomic_xchg_32 (var Target: longint;Source : longint) : longint; assembler; nostackframe;
{$endif VER3_2}
{ input: address of target in r3, source in r4 }
{ output: target in r3 }
{ side-effect: target := source }
@ -1144,7 +1164,12 @@ asm
end;
{$ifdef VER3_2}
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
{$else VER3_2}
{$define FPC_SYSTEM_HAS_ATOMIC_ADD_32}
function fpc_atomic_add_32 (var Target: longint;Value : longint) : longint; assembler; nostackframe;
{$endif VER3_2}
asm
.LInterLockedXchgAddLoop:
lwarx r10,0,r3
@ -1155,7 +1180,12 @@ asm
end;
{$ifdef VER3_2}
function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint; assembler; nostackframe;
{$else VER3_2}
{$define FPC_SYSTEM_HAS_ATOMIC_CMP_XCHG_32}
function fpc_atomic_cmp_xchg_32 (var Target: longint; NewValue: longint; Comparand: longint) : longint; [public,alias:'FPC_ATOMIC_CMP_XCHG_32']; assembler; nostackframe;
{$endif VER3_2}
{ input: address of target in r3, newvalue in r4, comparand in r5 }
{ output: value stored in target before entry of the function }
{ side-effect: NewValue stored in target if (target = comparand) }