|
@@ -19,6 +19,24 @@ interface
|
|
|
|
|
|
procedure AtomicFence; inline;
|
|
|
|
|
|
+function AtomicAdd(var Mem: Int8; Data: Int8): Int8; inline;
|
|
|
+function AtomicAdd(var Mem: UInt8; Data: UInt8): UInt8; inline;
|
|
|
+function AtomicAdd(var Mem: Int16; Data: Int16): Int16; inline;
|
|
|
+function AtomicAdd(var Mem: UInt16; Data: UInt16): UInt16; inline;
|
|
|
+function AtomicAdd(var Mem: Int32; Data: Int32): Int32; inline;
|
|
|
+function AtomicAdd(var Mem: UInt32; Data: UInt32): UInt32; inline;
|
|
|
+function AtomicAdd(var Mem: Int64; Data: Int64): Int64; inline;
|
|
|
+function AtomicAdd(var Mem: UInt64; Data: UInt64): UInt64; inline;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: Int8; Data: Int8): Int8; inline;
|
|
|
+function AtomicSub(var Mem: UInt8; Data: UInt8): UInt8; inline;
|
|
|
+function AtomicSub(var Mem: Int16; Data: Int16): Int16; inline;
|
|
|
+function AtomicSub(var Mem: UInt16; Data: UInt16): UInt16; inline;
|
|
|
+function AtomicSub(var Mem: Int32; Data: Int32): Int32; inline;
|
|
|
+function AtomicSub(var Mem: UInt32; Data: UInt32): UInt32; inline;
|
|
|
+function AtomicSub(var Mem: Int64; Data: Int64): Int64; inline;
|
|
|
+function AtomicSub(var Mem: UInt64; Data: UInt64): UInt64; inline;
|
|
|
+
|
|
|
implementation
|
|
|
|
|
|
{$I cpuh.inc}
|
|
@@ -28,4 +46,84 @@ begin
|
|
|
fpc_wasm32_atomic_fence;
|
|
|
end;
|
|
|
|
|
|
+function AtomicAdd(var Mem: Int8; Data: Int8): Int8; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=Int8(fpc_wasm32_i32_atomic_rmw8_add_u(@Mem,Byte(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: UInt8; Data: UInt8): UInt8; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=UInt8(fpc_wasm32_i32_atomic_rmw8_add_u(@Mem,Data));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: Int16; Data: Int16): Int16; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=Int16(fpc_wasm32_i32_atomic_rmw16_add_u(@Mem,Word(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: UInt16; Data: UInt16): UInt16; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=UInt16(fpc_wasm32_i32_atomic_rmw16_add_u(@Mem,Data));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: Int32; Data: Int32): Int32; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=Int32(fpc_wasm32_i32_atomic_rmw_add(@Mem,LongWord(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: UInt32; Data: UInt32): UInt32; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=fpc_wasm32_i32_atomic_rmw_add(@Mem,Data);
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: Int64; Data: Int64): Int64; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=Int64(fpc_wasm32_i64_atomic_rmw_add(@Mem,QWord(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicAdd(var Mem: UInt64; Data: UInt64): UInt64; inline;
|
|
|
+begin
|
|
|
+ AtomicAdd:=fpc_wasm32_i64_atomic_rmw_add(@Mem,Data);
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: Int8; Data: Int8): Int8; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=Int8(fpc_wasm32_i32_atomic_rmw8_sub_u(@Mem,Byte(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: UInt8; Data: UInt8): UInt8; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=UInt8(fpc_wasm32_i32_atomic_rmw8_sub_u(@Mem,Data));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: Int16; Data: Int16): Int16; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=Int16(fpc_wasm32_i32_atomic_rmw16_sub_u(@Mem,Word(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: UInt16; Data: UInt16): UInt16; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=UInt16(fpc_wasm32_i32_atomic_rmw16_sub_u(@Mem,Data));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: Int32; Data: Int32): Int32; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=Int32(fpc_wasm32_i32_atomic_rmw_sub(@Mem,LongWord(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: UInt32; Data: UInt32): UInt32; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=fpc_wasm32_i32_atomic_rmw_sub(@Mem,Data);
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: Int64; Data: Int64): Int64; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=Int64(fpc_wasm32_i64_atomic_rmw_sub(@Mem,QWord(Data)));
|
|
|
+end;
|
|
|
+
|
|
|
+function AtomicSub(var Mem: UInt64; Data: UInt64): UInt64; inline;
|
|
|
+begin
|
|
|
+ AtomicSub:=fpc_wasm32_i64_atomic_rmw_sub(@Mem,Data);
|
|
|
+end;
|
|
|
+
|
|
|
end.
|