+ Aarch64: completed LSE support for all interlocked operations

git-svn-id: trunk@49212 -
This commit is contained in:
florian 2021-04-16 19:33:31 +00:00
parent 0d5260396c
commit d53b17cadc
6 changed files with 107 additions and 13 deletions

View File

@ -398,9 +398,6 @@
'ror',
'neg',
'ins',
'cas',
'casp',
'ldadd',
'ldclr',
'ldeor',
'ldset',
@ -416,5 +413,16 @@
'stsmin',
'stumax',
'stumin',
'swp'
'swp',
'swpa',
'swpal',
'swpl',
'ldadd',
'ldadda',
'ldaddal',
'ldaddl',
'cas',
'casa',
'casal',
'casl'
);

View File

@ -416,5 +416,13 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE
);

View File

@ -800,11 +800,6 @@
; Large System Extensions
[CAS]
[CASP]
[LDADD]
[LDCLR]
@ -838,3 +833,25 @@
[SWP]
[SWPA]
[SWPAL]
[SWPL]
[LDADD]
[LDADDA]
[LDADDAL]
[LDADDL]
[CAS]
[CASA]
[CASAL]
[CASL]

View File

@ -398,9 +398,6 @@ A_LSR,
A_ROR,
A_NEG,
A_INS,
A_CAS,
A_CASP,
A_LDADD,
A_LDCLR,
A_LDEOR,
A_LDSET,
@ -416,5 +413,16 @@ A_STSMAX,
A_STSMIN,
A_STUMAX,
A_STUMIN,
A_SWP
A_SWP,
A_SWPA,
A_SWPAL,
A_SWPL,
A_LDADD,
A_LDADDA,
A_LDADDAL,
A_LDADDL,
A_CAS,
A_CASA,
A_CASAL,
A_CASL
);

View File

@ -883,11 +883,26 @@ implementation
result:=sr_complex;
end;
A_LDADD,
A_LDADDA,
A_LDADDAL,
A_LDADDL,
A_SWP,
A_SWPA,
A_SWPAL,
A_SWPL,
A_CAS,
A_CASA,
A_CASAL,
A_CASL,
A_STADD,
A_LDAR,
A_LDAXR,
A_LDXR,
A_LDXP,
A_STLR,
A_STLXR,
A_STLXP,

View File

@ -326,22 +326,30 @@ function InterLockedExchange (var Target: longint;Source : longint) : longint; a
{ output: target in x0 }
{ side-effect: target := source }
asm
{$ifdef CPUAARCH64_HAS_LSE}
swp w1,w0,[x0]
{$else CPUAARCH64_HAS_LSE}
.LInterLockedXchgLoop:
ldxr w2,[x0]
stxr w3,w1,[x0]
cbnz w3,.LInterLockedXchgLoop
mov w0,w2
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
ldadd w1,w0,[x0]
{$else CPUAARCH64_HAS_LSE}
.LInterLockedXchgAddLoop:
ldxr w2,[x0]
add w4,w2,w1
stxr w3,w4,[x0]
cbnz w3,.LInterLockedXchgAddLoop
mov w0,w2
{$endif CPUAARCH64_HAS_LSE}
end;
@ -350,6 +358,10 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
{ output: value stored in target before entry of the function }
{ side-effect: NewValue stored in target if (target = comparand) }
asm
{$ifdef CPUAARCH64_HAS_LSE}
cas w2,w1,[x0]
mov w0,w2
{$else CPUAARCH64_HAS_LSE}
.LInterlockedCompareExchangeLoop:
ldxr w3,[x0]
cmp w3,w2
@ -357,54 +369,79 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
stxr w5,w4,[x0]
cbnz w5,.LInterlockedCompareExchangeLoop
mov w0,w3
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedDecrement64 (var Target: int64) : int64; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
mov x1,#-1
ldadd x1,x2,[x0]
add x0,x2,x1
{$else CPUAARCH64_HAS_LSE}
.LInterDecLockedLoop:
ldxr x1,[x0]
sub x1,x1,#1
stxr w2,x1,[x0]
cbnz w2,.LInterDecLockedLoop
mov x0,x1
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedIncrement64 (var Target: int64) : int64; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
mov x1,#1
ldadd x1,x2,[x0]
add x0,x2,x1
{$else CPUAARCH64_HAS_LSE}
.LInterIncLockedLoop:
ldxr x1,[x0]
add x1,x1,#1
stxr w2,x1,[x0]
cbnz w2,.LInterIncLockedLoop
mov x0,x1
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedExchange64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
swp x1,x0,[x0]
{$else CPUAARCH64_HAS_LSE}
.LInterLockedXchgLoop:
ldxr x2,[x0]
stxr w3,x1,[x0]
cbnz w3,.LInterLockedXchgLoop
mov x0,x2
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedExchangeAdd64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
ldadd x1,x0,[x0]
{$else CPUAARCH64_HAS_LSE}
.LInterLockedXchgAddLoop:
ldxr x2,[x0]
add x4,x2,x1
stxr w3,x4,[x0]
cbnz w3,.LInterLockedXchgAddLoop
mov x0,x2
{$endif CPUAARCH64_HAS_LSE}
end;
function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : int64): int64; assembler; nostackframe;
asm
{$ifdef CPUAARCH64_HAS_LSE}
cas x2,x1,[x0]
mov x0,x2
{$else CPUAARCH64_HAS_LSE}
.LInterlockedCompareExchangeLoop:
ldxr x3,[x0]
cmp x3,x2
@ -412,6 +449,7 @@ function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : i
stxr w5,x4,[x0]
cbnz w5,.LInterlockedCompareExchangeLoop
mov x0,x3
{$endif CPUAARCH64_HAS_LSE}
end;