Browse Source

* new cpu feature tests

florian 2 years ago
parent
commit
3e6d4bf1cc
3 changed files with 62 additions and 0 deletions
  1. 18 0
      rtl/i386/cpu.pp
  2. 18 0
      rtl/x86_64/cpu.pp
  3. 26 0
      tests/test/units/cpu/tcpu1.pp

+ 18 - 0
rtl/i386/cpu.pp

@@ -56,6 +56,8 @@ unit cpu;
     function FMASupport: boolean;inline;
     function POPCNTSupport: boolean;inline;
     function LZCNTSupport: boolean;inline;
+    function SSE3Support: boolean;inline;
+    function SSSE3Support: boolean;inline;
     function SSE41Support: boolean;inline;
     function SSE42Support: boolean;inline;
     function MOVBESupport: boolean;inline;
@@ -98,6 +100,8 @@ unit cpu;
       _FMASupport,
       _POPCNTSupport,
       _LZCNTSupport,
+      _SSE3Support,
+      _SSSE3Support,
       _SSE41Support,
       _SSE42Support,
       _MOVBESupport,
@@ -228,6 +232,8 @@ unit cpu;
               _CMOVSupport:=(_edx and $8000)<>0;
               _AESSupport:=(_ecx and $2000000)<>0;
               _POPCNTSupport:=(_ecx and $800000)<>0;
+              _SSE3Support:=(_ecx and $1)<>0;
+              _SSSE3Support:=(_ecx and $200)<>0;
               _SSE41Support:=(_ecx and $80000)<>0;
               _SSE42Support:=(_ecx and $100000)<>0;
               _MOVBESupport:=(_ecx and $400000)<>0;
@@ -447,6 +453,18 @@ unit cpu;
       end;
 
 
+    function SSE3Support: boolean;inline;
+      begin
+        result:=_SSE3Support;
+      end;
+
+
+    function SSSE3Support: boolean;inline;
+      begin
+        result:=_SSSE3Support;
+      end;
+
+
     function SSE41Support: boolean;inline;
       begin
         result:=_SSE41Support;

+ 18 - 0
rtl/x86_64/cpu.pp

@@ -53,6 +53,8 @@ unit cpu;
     function FMASupport: boolean;inline;
     function POPCNTSupport: boolean;inline;
     function LZCNTSupport: boolean;inline;
+    function SSE3Support: boolean;inline;
+    function SSSE3Support: boolean;inline;
     function SSE41Support: boolean;inline;
     function SSE42Support: boolean;inline;
     function MOVBESupport: boolean;inline;
@@ -96,6 +98,8 @@ unit cpu;
       _FMASupport,
       _POPCNTSupport,
       _LZCNTSupport,
+      _SSE3Support,
+      _SSSE3Support,
       _SSE41Support,
       _SSE42Support,
       _MOVBESupport,
@@ -203,6 +207,8 @@ unit cpu;
         _InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
         _AESSupport:=(_ecx and $2000000)<>0;
         _POPCNTSupport:=(_ecx and $800000)<>0;
+        _SSE3Support:=(_ecx and $1)<>0;
+        _SSSE3Support:=(_ecx and $200)<>0;
         _SSE41Support:=(_ecx and $80000)<>0;
         _SSE42Support:=(_ecx and $100000)<>0;
         _MOVBESupport:=(_ecx and $400000)<>0;
@@ -415,6 +421,18 @@ unit cpu;
       end;
 
 
+    function SSE3Support: boolean;inline;
+      begin
+        result:=_SSE3Support;
+      end;
+
+
+    function SSSE3Support: boolean;inline;
+      begin
+        result:=_SSSE3Support;
+      end;
+
+
     function SSE41Support: boolean;inline;
       begin
         result:=_SSE41Support;

+ 26 - 0
tests/test/units/cpu/tcpu1.pp

@@ -19,6 +19,31 @@ begin
     end
   else
     writeln('no');
+
+  write('SSE3 support: ');
+  if SSE3Support then
+    begin
+      writeln('yes');
+      asm
+        pxor %xmm0,%xmm0
+        haddpd %xmm0,%xmm0
+      end;
+    end
+  else
+    writeln('no');
+
+  write('SSSE3 support: ');
+  if SSSE3Support then
+    begin
+      writeln('yes');
+      asm
+        pxor %xmm0,%xmm0
+        phaddsw %xmm0,%xmm0
+      end;
+    end
+  else
+    writeln('no');
+
   write('AES support: ');
   if AESSupport then
     begin
@@ -30,6 +55,7 @@ begin
     end
   else
     writeln('no');
+
   write('AVX support: ');
   if AVXSupport then
     begin