Browse Source

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

Sven/Sarah Barth 8 months ago
parent
commit
fdd0ebeed9
1 changed files with 30 additions and 0 deletions
  1. 30 0
      rtl/powerpc/powerpc.inc

+ 30 - 0
rtl/powerpc/powerpc.inc

@@ -1103,7 +1103,17 @@ asm
 end;
 end;
 
 
 
 
+{$ifndef VER3_2}
+{$define FPC_SYSTEM_INTERLOCKED_USE_INTRIN}
+{$endif VER3_2}
+
+
+{$ifdef VER3_2}
 function InterLockedDecrement (var Target: longint) : longint; assembler; nostackframe;
 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 }
 { input:  address of target in r3 }
 { output: target-1 in r3          }
 { output: target-1 in r3          }
 { side-effect: target := target-1 }
 { side-effect: target := target-1 }
@@ -1117,7 +1127,12 @@ asm
 end;
 end;
 
 
 
 
+{$ifdef VER3_2}
 function InterLockedIncrement (var Target: longint) : longint; assembler; nostackframe;
 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 }
 { input:  address of target in r3 }
 { output: target+1 in r3          }
 { output: target+1 in r3          }
 { side-effect: target := target+1 }
 { side-effect: target := target+1 }
@@ -1131,7 +1146,12 @@ asm
 end;
 end;
 
 
 
 
+{$ifdef VER3_2}
 function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler; nostackframe;
 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 }
 { input:  address of target in r3, source in r4 }
 { output: target in r3                          }
 { output: target in r3                          }
 { side-effect: target := source                 }
 { side-effect: target := source                 }
@@ -1144,7 +1164,12 @@ asm
 end;
 end;
 
 
 
 
+{$ifdef VER3_2}
 function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
 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
 asm
 .LInterLockedXchgAddLoop:
 .LInterLockedXchgAddLoop:
         lwarx   r10,0,r3
         lwarx   r10,0,r3
@@ -1155,7 +1180,12 @@ asm
 end;
 end;
 
 
 
 
+{$ifdef VER3_2}
 function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint; assembler; nostackframe;
 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 }
 { input:  address of target in r3, newvalue in r4, comparand in r5 }
 { 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)   }