Browse Source

Set FPC_USE_INTRINSICS when appropriate for most platforms

Pierre Muller 1 day ago
parent
commit
bc4842d19b
5 changed files with 100 additions and 17 deletions
  1. 20 2
      rtl/amicommon/classes.pp
  2. 20 2
      rtl/embedded/classes.pp
  3. 20 9
      rtl/unix/classes.pp
  4. 20 2
      rtl/win32/classes.pp
  5. 20 2
      rtl/win64/classes.pp

+ 20 - 2
rtl/amicommon/classes.pp

@@ -19,6 +19,21 @@
 {$IF FPC_FULLVERSION>=30301}
 {$modeswitch FUNCTIONREFERENCES}
 {$define FPC_HAS_REFERENCE_PROCEDURE}
+{$ifndef CPULLVM}
+{$if DEFINED(CPUARM) or DEFINED(CPUAARCH64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{ Also set FPC_USE_INTRINSICS for i386 and x86_64 }
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$endif}
 {$endif}
 
 { determine the type of the resource/form file }
@@ -38,6 +53,9 @@ uses
   System.SortBase,
 {$ifdef FPC_TESTGENERICS}
   System.FGL,
+{$endif}
+{$ifdef FPC_USE_INTRINSICS}
+  System.Intrinsics,
 {$endif}
   System.TypInfo;
 {$ELSE FPC_DOTTEDUNITS}
@@ -49,9 +67,9 @@ uses
 {$ifdef FPC_TESTGENERICS}
   fgl,
 {$endif}
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+{$ifdef FPC_USE_INTRINSICS}
   intrinsics,
-{$ENDIF}
+{$endif}
   typinfo;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 20 - 2
rtl/embedded/classes.pp

@@ -19,6 +19,21 @@
 {$IF FPC_FULLVERSION>=30301}
 {$modeswitch FUNCTIONREFERENCES}
 {$define FPC_HAS_REFERENCE_PROCEDURE}
+{$ifndef CPULLVM}
+{$if DEFINED(CPUARM) or DEFINED(CPUAARCH64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{ Also set FPC_USE_INTRINSICS for i386 and x86_64 }
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$endif}
 {$endif}
 
 {$IFNDEF FPC_DOTTEDUNITS}
@@ -35,6 +50,9 @@ uses
   System.SortBase,
 {$ifdef FPC_TESTGENERICS}
   System.FGL,
+{$endif}
+{$ifdef FPC_USE_INTRINSICS}
+  System.Intrinsics,
 {$endif}
   System.TypInfo;
 {$ELSE FPC_DOTTEDUNITS}
@@ -46,9 +64,9 @@ uses
 {$ifdef FPC_TESTGENERICS}
   fgl,
 {$endif}
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+{$ifdef FPC_USE_INTRINSICS}
   intrinsics,
-{$ENDIF}
+{$endif}
   typinfo;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 20 - 9
rtl/unix/classes.pp

@@ -16,9 +16,24 @@
 {$mode objfpc}
 {$h+}
 {$modeswitch advancedrecords}
-{$IF FPC_FULLVERSION>=30301}
+{$if FPC_FULLVERSION>=30301}
 {$modeswitch FUNCTIONREFERENCES}
 {$define FPC_HAS_REFERENCE_PROCEDURE}
+{$ifndef CPULLVM}
+{$if DEFINED(CPUARM) or DEFINED(CPUAARCH64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{ Also set FPC_USE_INTRINSICS for i386 and x86_64 }
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$endif}
 {$endif}
 { determine the type of the resource/form file }
 {$define Win16Res}
@@ -39,11 +54,9 @@ uses
   System.FGL,
 {$endif}
   System.RtlConsts,
-{$IF FPC_FULLVERSION>=30301}
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) or defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+{$ifdef FPC_USE_INTRINSICS}
   System.Intrinsics,
-{$ENDIF}
-{$ENDIF}
+{$endif}
   System.SortBase;
 {$ELSE FPC_DOTTEDUNITS}
 uses
@@ -54,11 +67,9 @@ uses
   fgl,
 {$endif}
   rtlconsts,
-{$IF FPC_FULLVERSION>=30301}
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) or defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+{$ifdef FPC_USE_INTRINSICS}
   intrinsics,
-{$ENDIF}
-{$ENDIF}
+{$endif}
   sortbase;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 20 - 2
rtl/win32/classes.pp

@@ -19,6 +19,21 @@
 {$IF FPC_FULLVERSION>=30301}
 {$modeswitch FUNCTIONREFERENCES}
 {$define FPC_HAS_REFERENCE_PROCEDURE}
+{$ifndef CPULLVM}
+{$if DEFINED(CPUARM) or DEFINED(CPUAARCH64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{ Also set FPC_USE_INTRINSICS for i386 and x86_64 }
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$endif}
 {$endif}
 
 { determine the type of the resource/form file }
@@ -40,6 +55,9 @@ uses
   System.FGL,
 {$endif}
   System.TypInfo,
+{$ifdef FPC_USE_INTRINSICS}
+  System.Intrinsics,
+{$endif}
   WinApi.Windows;
 {$ELSE FPC_DOTTEDUNITS}
 uses
@@ -51,9 +69,9 @@ uses
   fgl,
 {$endif}
   typinfo,
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+{$ifdef FPC_USE_INTRINSICS}
   intrinsics,
-{$ENDIF}
+{$endif}
   windows;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 20 - 2
rtl/win64/classes.pp

@@ -19,6 +19,21 @@
 {$IF FPC_FULLVERSION>=30301}
 {$modeswitch FUNCTIONREFERENCES}
 {$define FPC_HAS_REFERENCE_PROCEDURE}
+{$ifndef CPULLVM}
+{$if DEFINED(CPUARM) or DEFINED(CPUAARCH64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPUPOWERPC) or defined(CPUPOWERPC64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{ Also set FPC_USE_INTRINSICS for i386 and x86_64 }
+{$if defined(CPURISCV32) or defined(CPURISCV64)}
+   {$define FPC_USE_INTRINSICS}
+{$endif}
+{$endif}
 {$endif}
 
 { determine the type of the resource/form file }
@@ -40,6 +55,9 @@ uses
   System.FGL,
 {$endif}
   System.TypInfo,
+{$ifdef FPC_USE_INTRINSICS}
+  System.Intrinsics,
+{$endif}
   WinApi.Windows;
 {$ELSE FPC_DOTTEDUNITS}
 uses
@@ -51,9 +69,9 @@ uses
   fgl,
 {$endif}
   typinfo,
-{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+{$ifdef FPC_USE_INTRINSICS}
   intrinsics,
-{$ENDIF}
+{$endif}
   windows;
 {$ENDIF FPC_DOTTEDUNITS}