mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 05:08:03 +02:00
o unified interface of i386 and x86-64 cpu unit:
+ InterlockedCompareExchange128Support for i386 always returning false + AESSupport for i386 + dummy InterlockedCompareExchange128 for i386 throwing an rte 217 git-svn-id: trunk@32857 -
This commit is contained in:
parent
4bf603694c
commit
77cf67b59a
@ -15,8 +15,12 @@
|
||||
**********************************************************************}
|
||||
{$mode objfpc}
|
||||
unit cpu;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
sysutils;
|
||||
|
||||
{ returns true, if the processor supports the cpuid instruction }
|
||||
function cpuid_support : boolean;
|
||||
|
||||
@ -26,6 +30,8 @@ unit cpu;
|
||||
{ returns the contents of the cr0 register }
|
||||
function cr0 : longint;
|
||||
|
||||
function InterlockedCompareExchange128Support : boolean;
|
||||
function AESSupport : boolean;inline;
|
||||
function AVXSupport: boolean;inline;
|
||||
function AVX2Support: boolean;inline;
|
||||
function FMASupport: boolean;inline;
|
||||
@ -33,14 +39,24 @@ unit cpu;
|
||||
var
|
||||
is_sse3_cpu : boolean = false;
|
||||
|
||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
|
||||
|
||||
implementation
|
||||
|
||||
{$ASMMODE INTEL}
|
||||
var
|
||||
_AVXSupport,
|
||||
_AVX2Support,
|
||||
_AESSupport,
|
||||
_FMASupport : boolean;
|
||||
|
||||
|
||||
function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
|
||||
begin
|
||||
RunError(217);
|
||||
end;
|
||||
|
||||
|
||||
function cpuid_support : boolean;assembler;
|
||||
{
|
||||
Check if the ID-flag can be changed, if changed then CpuID is supported.
|
||||
@ -106,7 +122,8 @@ unit cpu;
|
||||
movl %ecx,_ecx
|
||||
popl %ebx
|
||||
end;
|
||||
is_sse3_cpu:=(_ecx and $1)<>0;
|
||||
_AESSupport:=(_ecx and $2000000)<>0;
|
||||
|
||||
_AVXSupport:=
|
||||
{ XGETBV suspport? }
|
||||
((_ecx and $08000000)<>0) and
|
||||
@ -115,6 +132,8 @@ unit cpu;
|
||||
{ avx supported? }
|
||||
((_ecx and $10000000)<>0);
|
||||
|
||||
is_sse3_cpu:=(_ecx and $1)<>0;
|
||||
|
||||
_FMASupport:=_AVXSupport and ((_ecx and $1000)<>0);
|
||||
|
||||
asm
|
||||
@ -130,6 +149,19 @@ unit cpu;
|
||||
end;
|
||||
|
||||
|
||||
function InterlockedCompareExchange128Support : boolean;
|
||||
begin
|
||||
{ 32 Bit CPUs have no 128 Bit interlocked exchange support }
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
|
||||
function AESSupport : boolean;
|
||||
begin
|
||||
result:=_AESSupport;
|
||||
end;
|
||||
|
||||
|
||||
function AVXSupport: boolean;inline;
|
||||
begin
|
||||
result:=_AVXSupport;
|
||||
|
Loading…
Reference in New Issue
Block a user