mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 09:09:25 +02:00
+ Aarch64: completed LSE support for all interlocked operations
git-svn-id: trunk@49212 -
This commit is contained in:
parent
0d5260396c
commit
d53b17cadc
@ -398,9 +398,6 @@
|
|||||||
'ror',
|
'ror',
|
||||||
'neg',
|
'neg',
|
||||||
'ins',
|
'ins',
|
||||||
'cas',
|
|
||||||
'casp',
|
|
||||||
'ldadd',
|
|
||||||
'ldclr',
|
'ldclr',
|
||||||
'ldeor',
|
'ldeor',
|
||||||
'ldset',
|
'ldset',
|
||||||
@ -416,5 +413,16 @@
|
|||||||
'stsmin',
|
'stsmin',
|
||||||
'stumax',
|
'stumax',
|
||||||
'stumin',
|
'stumin',
|
||||||
'swp'
|
'swp',
|
||||||
|
'swpa',
|
||||||
|
'swpal',
|
||||||
|
'swpl',
|
||||||
|
'ldadd',
|
||||||
|
'ldadda',
|
||||||
|
'ldaddal',
|
||||||
|
'ldaddl',
|
||||||
|
'cas',
|
||||||
|
'casa',
|
||||||
|
'casal',
|
||||||
|
'casl'
|
||||||
);
|
);
|
||||||
|
@ -416,5 +416,13 @@ attsufNONE,
|
|||||||
attsufNONE,
|
attsufNONE,
|
||||||
attsufNONE,
|
attsufNONE,
|
||||||
attsufNONE,
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
|
attsufNONE,
|
||||||
attsufNONE
|
attsufNONE
|
||||||
);
|
);
|
||||||
|
@ -800,11 +800,6 @@
|
|||||||
|
|
||||||
; Large System Extensions
|
; Large System Extensions
|
||||||
|
|
||||||
[CAS]
|
|
||||||
|
|
||||||
[CASP]
|
|
||||||
|
|
||||||
[LDADD]
|
|
||||||
|
|
||||||
[LDCLR]
|
[LDCLR]
|
||||||
|
|
||||||
@ -838,3 +833,25 @@
|
|||||||
|
|
||||||
[SWP]
|
[SWP]
|
||||||
|
|
||||||
|
[SWPA]
|
||||||
|
|
||||||
|
[SWPAL]
|
||||||
|
|
||||||
|
[SWPL]
|
||||||
|
|
||||||
|
[LDADD]
|
||||||
|
|
||||||
|
[LDADDA]
|
||||||
|
|
||||||
|
[LDADDAL]
|
||||||
|
|
||||||
|
[LDADDL]
|
||||||
|
|
||||||
|
[CAS]
|
||||||
|
|
||||||
|
[CASA]
|
||||||
|
|
||||||
|
[CASAL]
|
||||||
|
|
||||||
|
[CASL]
|
||||||
|
|
||||||
|
@ -398,9 +398,6 @@ A_LSR,
|
|||||||
A_ROR,
|
A_ROR,
|
||||||
A_NEG,
|
A_NEG,
|
||||||
A_INS,
|
A_INS,
|
||||||
A_CAS,
|
|
||||||
A_CASP,
|
|
||||||
A_LDADD,
|
|
||||||
A_LDCLR,
|
A_LDCLR,
|
||||||
A_LDEOR,
|
A_LDEOR,
|
||||||
A_LDSET,
|
A_LDSET,
|
||||||
@ -416,5 +413,16 @@ A_STSMAX,
|
|||||||
A_STSMIN,
|
A_STSMIN,
|
||||||
A_STUMAX,
|
A_STUMAX,
|
||||||
A_STUMIN,
|
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
|
||||||
);
|
);
|
||||||
|
@ -883,11 +883,26 @@ implementation
|
|||||||
result:=sr_complex;
|
result:=sr_complex;
|
||||||
end;
|
end;
|
||||||
A_LDADD,
|
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_STADD,
|
||||||
A_LDAR,
|
A_LDAR,
|
||||||
A_LDAXR,
|
A_LDAXR,
|
||||||
A_LDXR,
|
A_LDXR,
|
||||||
A_LDXP,
|
A_LDXP,
|
||||||
|
|
||||||
A_STLR,
|
A_STLR,
|
||||||
A_STLXR,
|
A_STLXR,
|
||||||
A_STLXP,
|
A_STLXP,
|
||||||
|
@ -326,22 +326,30 @@ function InterLockedExchange (var Target: longint;Source : longint) : longint; a
|
|||||||
{ output: target in x0 }
|
{ output: target in x0 }
|
||||||
{ side-effect: target := source }
|
{ side-effect: target := source }
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
swp w1,w0,[x0]
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterLockedXchgLoop:
|
.LInterLockedXchgLoop:
|
||||||
ldxr w2,[x0]
|
ldxr w2,[x0]
|
||||||
stxr w3,w1,[x0]
|
stxr w3,w1,[x0]
|
||||||
cbnz w3,.LInterLockedXchgLoop
|
cbnz w3,.LInterLockedXchgLoop
|
||||||
mov w0,w2
|
mov w0,w2
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
|
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
ldadd w1,w0,[x0]
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterLockedXchgAddLoop:
|
.LInterLockedXchgAddLoop:
|
||||||
ldxr w2,[x0]
|
ldxr w2,[x0]
|
||||||
add w4,w2,w1
|
add w4,w2,w1
|
||||||
stxr w3,w4,[x0]
|
stxr w3,w4,[x0]
|
||||||
cbnz w3,.LInterLockedXchgAddLoop
|
cbnz w3,.LInterLockedXchgAddLoop
|
||||||
mov w0,w2
|
mov w0,w2
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -350,6 +358,10 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
|
|||||||
{ output: value stored in target before entry of the function }
|
{ output: value stored in target before entry of the function }
|
||||||
{ side-effect: NewValue stored in target if (target = comparand) }
|
{ side-effect: NewValue stored in target if (target = comparand) }
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
cas w2,w1,[x0]
|
||||||
|
mov w0,w2
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterlockedCompareExchangeLoop:
|
.LInterlockedCompareExchangeLoop:
|
||||||
ldxr w3,[x0]
|
ldxr w3,[x0]
|
||||||
cmp w3,w2
|
cmp w3,w2
|
||||||
@ -357,54 +369,79 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
|
|||||||
stxr w5,w4,[x0]
|
stxr w5,w4,[x0]
|
||||||
cbnz w5,.LInterlockedCompareExchangeLoop
|
cbnz w5,.LInterlockedCompareExchangeLoop
|
||||||
mov w0,w3
|
mov w0,w3
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedDecrement64 (var Target: int64) : int64; assembler; nostackframe;
|
function InterLockedDecrement64 (var Target: int64) : int64; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
mov x1,#-1
|
||||||
|
ldadd x1,x2,[x0]
|
||||||
|
add x0,x2,x1
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterDecLockedLoop:
|
.LInterDecLockedLoop:
|
||||||
ldxr x1,[x0]
|
ldxr x1,[x0]
|
||||||
sub x1,x1,#1
|
sub x1,x1,#1
|
||||||
stxr w2,x1,[x0]
|
stxr w2,x1,[x0]
|
||||||
cbnz w2,.LInterDecLockedLoop
|
cbnz w2,.LInterDecLockedLoop
|
||||||
mov x0,x1
|
mov x0,x1
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedIncrement64 (var Target: int64) : int64; assembler; nostackframe;
|
function InterLockedIncrement64 (var Target: int64) : int64; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
mov x1,#1
|
||||||
|
ldadd x1,x2,[x0]
|
||||||
|
add x0,x2,x1
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterIncLockedLoop:
|
.LInterIncLockedLoop:
|
||||||
ldxr x1,[x0]
|
ldxr x1,[x0]
|
||||||
add x1,x1,#1
|
add x1,x1,#1
|
||||||
stxr w2,x1,[x0]
|
stxr w2,x1,[x0]
|
||||||
cbnz w2,.LInterIncLockedLoop
|
cbnz w2,.LInterIncLockedLoop
|
||||||
mov x0,x1
|
mov x0,x1
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedExchange64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
|
function InterLockedExchange64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
swp x1,x0,[x0]
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterLockedXchgLoop:
|
.LInterLockedXchgLoop:
|
||||||
ldxr x2,[x0]
|
ldxr x2,[x0]
|
||||||
stxr w3,x1,[x0]
|
stxr w3,x1,[x0]
|
||||||
cbnz w3,.LInterLockedXchgLoop
|
cbnz w3,.LInterLockedXchgLoop
|
||||||
mov x0,x2
|
mov x0,x2
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedExchangeAdd64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
|
function InterLockedExchangeAdd64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
ldadd x1,x0,[x0]
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterLockedXchgAddLoop:
|
.LInterLockedXchgAddLoop:
|
||||||
ldxr x2,[x0]
|
ldxr x2,[x0]
|
||||||
add x4,x2,x1
|
add x4,x2,x1
|
||||||
stxr w3,x4,[x0]
|
stxr w3,x4,[x0]
|
||||||
cbnz w3,.LInterLockedXchgAddLoop
|
cbnz w3,.LInterLockedXchgAddLoop
|
||||||
mov x0,x2
|
mov x0,x2
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : int64): int64; assembler; nostackframe;
|
function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : int64): int64; assembler; nostackframe;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef CPUAARCH64_HAS_LSE}
|
||||||
|
cas x2,x1,[x0]
|
||||||
|
mov x0,x2
|
||||||
|
{$else CPUAARCH64_HAS_LSE}
|
||||||
.LInterlockedCompareExchangeLoop:
|
.LInterlockedCompareExchangeLoop:
|
||||||
ldxr x3,[x0]
|
ldxr x3,[x0]
|
||||||
cmp x3,x2
|
cmp x3,x2
|
||||||
@ -412,6 +449,7 @@ function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : i
|
|||||||
stxr w5,x4,[x0]
|
stxr w5,x4,[x0]
|
||||||
cbnz w5,.LInterlockedCompareExchangeLoop
|
cbnz w5,.LInterlockedCompareExchangeLoop
|
||||||
mov x0,x3
|
mov x0,x3
|
||||||
|
{$endif CPUAARCH64_HAS_LSE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user