diff --git a/compiler/options.pas b/compiler/options.pas index cf973efcf9..747cec779b 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -2046,6 +2046,9 @@ begin {$ifdef SUPPORT_UNALIGNED} def_system_macro('FPC_SUPPORTS_UNALIGNED'); {$endif SUPPORT_UNALIGNED} +{$ifdef powerpc64} + def_system_macro('FPC_HAS_LWSYNC'); +{$endif} {$if defined(x86) or defined(arm)} def_system_macro('INTERNAL_BACKTRACE'); diff --git a/compiler/powerpc64/cpubase.pas b/compiler/powerpc64/cpubase.pas index eb3291d022..1bb6dcf623 100644 --- a/compiler/powerpc64/cpubase.pas +++ b/compiler/powerpc64/cpubase.pas @@ -103,7 +103,8 @@ type A_MULLDO, A_MULLDO_, A_MULHDU, A_MULHDU_, A_MFXER, A_FCTID, A_FCTID_, A_FCTIDZ, A_FCTIDZ_, - A_EXTRDI, A_EXTRDI_, A_INSRDI, A_INSRDI_); + A_EXTRDI, A_EXTRDI_, A_INSRDI, A_INSRDI_, + A_LWSYNC); {# This should define the array of instructions as string } op2strtable = array[tasmop] of string[8]; diff --git a/compiler/powerpc64/itcpugas.pas b/compiler/powerpc64/itcpugas.pas index 32fc02f9f2..cd2f656bbb 100644 --- a/compiler/powerpc64/itcpugas.pas +++ b/compiler/powerpc64/itcpugas.pas @@ -93,7 +93,8 @@ const 'mulldo', 'mulldo.', 'mulhdu', 'mulhdu.', 'mfxer', 'fctid', 'fctid.', 'fctidz', 'fctidz.', - 'extrdi', 'extrdi.', 'insrdi', 'insrdi.'); + 'extrdi', 'extrdi.', 'insrdi', 'insrdi.', + 'lwsync'); function gas_regnum_search(const s: string): Tregister; function gas_regname(r: Tregister): string; diff --git a/rtl/powerpc64/powerpc64.inc b/rtl/powerpc64/powerpc64.inc index cee0a1e871..840db6f32f 100644 --- a/rtl/powerpc64/powerpc64.inc +++ b/rtl/powerpc64/powerpc64.inc @@ -842,11 +842,13 @@ end; procedure ReadBarrier;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif} asm +{$ifdef FPC_HAS_LWSYNC} lwsync +{$endif} end; procedure ReadDependencyBarrier;{$ifdef SYSTEMINLINE}inline;{$endif} -asm +begin { reads imply barrier on earlier reads depended on } end;