Jump to content
Sign in to follow this  
KaFu

Detecting CPU Type (Intel P3/P4, AMD)

Recommended Posts

KaFu

HiHo,

to further enhance my project I need to detect the installed CPU type. The program relies on the MPlayer, and there exist always four builds: P3, P4, Athlon and RTM (runtime detection for unknown CPUs). To decide which build to use I found a small app called cpuinfo.exe in one of the installers for MPlayer.

Now my question is, are the checks I'm doing sufficient and correct? Also ripped em from the MPlayer installer :graduated: .

#include <Constants.au3>
 
Local $iPID_CPUInfo = Run(@ScriptDir & "\cpuinfo.exe", @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
Local $sStdout_Buffer_CPUInfo, $s_CPU_Detected
While 1
    $sStdout_Buffer_CPUInfo &= StdoutRead($iPID_CPUInfo)
    If @error Then ExitLoop
WEnd
 
If StringInStr($sStdout_Buffer_CPUInfo, "3DNOWEXT") Then
    $s_CPU_Detected = "AMD Athlon"
ElseIf StringInStr($sStdout_Buffer_CPUInfo, "SSE2") Then
    $s_CPU_Detected = "Intel P4"
ElseIf StringInStr($sStdout_Buffer_CPUInfo, "SSE") Then
    $s_CPU_Detected = "Intel P3"
Else
    $s_CPU_Detected = "Unknown CPU"
EndIf
 
MsgBox(0, "Your system is running on an", $s_CPU_Detected)

Here's the detection part from the NSIS installer script, but the checks for MMX, CMOV and SSE seemed superfluous to me.

!insertmacro CheckCPUExt "$2" "MMX" CPU_HAS_MMX
  Goto CPU_DETECTION_DONE
 
  CPU_HAS_MMX:
  !insertmacro CheckCPUExt "$2" "CMOV" CPU_HAS_CMOV
  Goto CPU_DETECTION_DONE
 
  CPU_HAS_CMOV:
  !insertmacro CheckCPUExt "$2" "SSE" CPU_HAS_SSE
  Goto CPU_DETECTION_DONE
 
  CPU_HAS_SSE:
  !insertmacro CheckCPUExt "$2" "3DNOWEXT" CPU_HAS_3DNOWEXT
  !insertmacro CheckCPUExt "$2" "SSE2" CPU_HAS_SSE2
  StrCpy $4 3 #P3
  Goto CPU_DETECTION_DONE
 
  CPU_HAS_3DNOWEXT:
  StrCpy $4 2 #AthlonXP
  Goto CPU_DETECTION_DONE
 
  CPU_HAS_SSE2:
  StrCpy $4 4 #P4
  Goto CPU_DETECTION_DONE

cpuinfo.zip

Best Regards

Edited by KaFu

Share this post


Link to post
Share on other sites
BrewManNH

Here's a script generated by that might help.

; Generated by AutoIt Scriptomatic
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "ROOTCIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "AddressWidth: " & $objItem.AddressWidth & @CRLF
      $Output = $Output & "Architecture: " & $objItem.Architecture & @CRLF
      $Output = $Output & "Availability: " & $objItem.Availability & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
      $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
      $Output = $Output & "CpuStatus: " & $objItem.CpuStatus & @CRLF
      $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
      $Output = $Output & "CurrentClockSpeed: " & $objItem.CurrentClockSpeed & @CRLF
      $Output = $Output & "CurrentVoltage: " & $objItem.CurrentVoltage & @CRLF
      $Output = $Output & "DataWidth: " & $objItem.DataWidth & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF
      $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
      $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
      $Output = $Output & "ExtClock: " & $objItem.ExtClock & @CRLF
      $Output = $Output & "Family: " & $objItem.Family & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "L2CacheSize: " & $objItem.L2CacheSize & @CRLF
      $Output = $Output & "L2CacheSpeed: " & $objItem.L2CacheSpeed & @CRLF
      $Output = $Output & "L3CacheSize: " & $objItem.L3CacheSize & @CRLF
      $Output = $Output & "L3CacheSpeed: " & $objItem.L3CacheSpeed & @CRLF
      $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
      $Output = $Output & "Level: " & $objItem.Level & @CRLF
      $Output = $Output & "LoadPercentage: " & $objItem.LoadPercentage & @CRLF
      $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
      $Output = $Output & "MaxClockSpeed: " & $objItem.MaxClockSpeed & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "NumberOfCores: " & $objItem.NumberOfCores & @CRLF
      $Output = $Output & "NumberOfLogicalProcessors: " & $objItem.NumberOfLogicalProcessors & @CRLF
      $Output = $Output & "OtherFamilyDescription: " & $objItem.OtherFamilyDescription & @CRLF
      $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
      $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
      $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
      $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
      $Output = $Output & "ProcessorId: " & $objItem.ProcessorId & @CRLF
      $Output = $Output & "ProcessorType: " & $objItem.ProcessorType & @CRLF
      $Output = $Output & "Revision: " & $objItem.Revision & @CRLF
      $Output = $Output & "Role: " & $objItem.Role & @CRLF
      $Output = $Output & "SocketDesignation: " & $objItem.SocketDesignation & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF
      $Output = $Output & "Stepping: " & $objItem.Stepping & @CRLF
      $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
      $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF
      $Output = $Output & "UniqueId: " & $objItem.UniqueId & @CRLF
      $Output = $Output & "UpgradeMethod: " & $objItem.UpgradeMethod & @CRLF
      $Output = $Output & "Version: " & $objItem.Version & @CRLF
      $Output = $Output & "VoltageCaps: " & $objItem.VoltageCaps & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Processor" )
Endif
 
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc
Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Ascend4nt

Registry method:

; ===============================================================================================================================
; Func _CPURegistryInfo()
;
; Get # of cores, name, and clock speed of CPU from Registry
;
; Returns:
;   Success: An array of information, as follows:
;       [0] = # of Reported CPU's (can include 'logical' processors as well (# CPU's * # of hyperthreads))
;       [1] = CPU Speed (Mhz)
;       [2] = CPU Name
;       [3] = Identifier (family, model, stepping)
;       [4] = Vendor name
;       [5] = Feature Set (unsure what values are which..)
;   Failure: @error = same as returned by RegEnumKey(), with an empty array ([0] = -1 though)
;       @error = 1 = unable to open requested key
;       @error = 2 = unable to open requested Main key
;       @error = 3 = unable to connect to *remote* registry (not likely a return here)
;       @error = -1 = unable to retrieve requested subkey (key instance out of range)
;
; Author: tip (as _FasterCpuInfo), slight adjustments by Ascend4nt
;   AutoIT forums thread: "Basic Cpu Info Script, Collects basic information about CPU."
;        @ http://www.autoitscript.com/forum/index.php?showtopic=83373&hl=cpu++cores
; ===============================================================================================================================
 
Func _CPURegistryInfo()
    Local $aCPUInfo[6]
 
    $aCPUInfo[0]=EnvGet("NUMBER_OF_PROCESSORS")
 
    If @error Then Return SetError(@error,0,$aCPUInfo)
    
    $aCPUInfo[1] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","~MHz")
    $aCPUInfo[2] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","ProcessorNameString")
    $aCPUInfo[3] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","Identifier")
    $aCPUInfo[4] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","VendorIdentifier")
    $aCPUInfo[5] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","FeatureSet")
#cs
    ; Full Info Display
    MsgBox(64,"CPU Report from Registry","Processor Count [includes logical]: "&$aCPUInfo[0]&@CRLF& _
        "Speed: "&$aCPUInfo[1]&" Mhz"&@CRLF& _
        "Processor Name String: "&$aCPUInfo[2]&@CRLF& _
        "Processor Identifier String: "&$aCPUInfo[3]&@CRLF& _
        "Vendor Identifier String: "&$aCPUInfo[4]&@CRLF& _
        "FeatureSet: "&Hex($aCPUInfo[5]))
#ce
    Return $aCPUInfo
EndFunc
Edited by Ascend4nt

Share this post


Link to post
Share on other sites
Ramzes

You can also use ASM method:

Func Demo6()
; Demo 6: Read CPUID
FasmReset($Fasm)
FasmAdd($Fasm, "use32")
FasmAdd($Fasm, "push ebp")
FasmAdd($Fasm, "mov ebp, esp")
FasmAdd($Fasm, "pushad")
FasmAdd($Fasm, "xor eax, eax")
FasmAdd($Fasm, "cpuid")
FasmAdd($Fasm, "mov edi, [ebp + 08]")
FasmAdd($Fasm, "mov [edi], ebx")
FasmAdd($Fasm, "mov [edi + 4], edx")
FasmAdd($Fasm, "mov [edi + 8], ecx")
FasmAdd($Fasm, "mov al, 0")
FasmAdd($Fasm, "mov [edi + 12], al")
FasmAdd($Fasm, "popad")
FasmAdd($Fasm, "pop ebp")
FasmAdd($Fasm, "ret 4")
ConsoleWrite(String(FasmGetBinary($Fasm)) & @CRLF)
Local $Ret = MemoryFuncCall("uint", FasmGetFuncPtr($Fasm), "str", "")
MsgBox(0, "Demo 6: CPUID", "CPUID = " & $Ret[1])
EndFunc

This is Demo #6 from examples.

Script returns:

CPUID = AuthenticAMD


Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites
KaFu

Thanks for the replies guys :graduated:. After doing some more reading I guess I'll stick to my initial version. The feature sets I switch on (3DNOWEXT, SSE & SSE2) seem to be unique the different CPU builds and I need exactly the differentiation between P3, P4, Athlon and Unknown (as these are also the different MPlayer builds available). All other suggestions result in strings to parse... but how consistent are these strings really between the dozens of different CPU layouts ;)?

Share this post


Link to post
Share on other sites
Ascend4nt

For checking on processor features, look at IsProcessorFeaturePresent. You can also check this stuff with CPUID.

Share this post


Link to post
Share on other sites
KaFu

Nice, thanks for that hint m8, no need for an external app anymore :graduated:...

Global $s_CPU_Detected = "Unknown CPU"
If _IsProcessorFeaturePresent(7) Then
    $s_CPU_Detected = "AMD Athlon"
ElseIf _IsProcessorFeaturePresent(10) Then
    $s_CPU_Detected = "Intel P4"
ElseIf _IsProcessorFeaturePresent(6) Then
    $s_CPU_Detected = "Intel P3"
EndIf

MsgBox(0, "IsProcessorFeaturePresent", "3DNOW" & @TAB & _IsProcessorFeaturePresent(7) & @CRLF & "SSE" & @TAB & _IsProcessorFeaturePresent(6) & @CRLF & "SSE2" & @TAB & _IsProcessorFeaturePresent(10) & @CRLF & @CRLF & "=>" & @TAB & $s_CPU_Detected)

Func _IsProcessorFeaturePresent($iFeature)
    #cs
        _IsProcessorFeaturePresent(7) ; PF_3DNOW_INSTRUCTIONS_AVAILABLE
        _IsProcessorFeaturePresent(6) ; PF_XMMI_INSTRUCTIONS_AVAILABLE (SSE)
        _IsProcessorFeaturePresent(10) ; PF_XMMI64_INSTRUCTIONS_AVAILABLE (SSE2)
    #ce
    ; http://msdn.microsoft.com/en-us/library/ms724482%28v=VS.85%29.aspx
    $iRes = DllCall("Kernel32.dll", "int", "IsProcessorFeaturePresent", "DWORD", $iFeature)
    Return $iRes[0]
EndFunc   ;==>_IsProcessorFeaturePresent

Share this post


Link to post
Share on other sites
Chimaera

That returns for me

3DNOW 0

SSE 1

SSE2 1

=> Intel P4

But mine is this

|Intel® Core™ i5 CPU 750 @ 2.67GHz

Is there a way to include more cpus?

Share this post


Link to post
Share on other sites
AdmiralAlkex

That returns for me

But mine is this

|Intel® Core™ i5 CPU 750 @ 2.67GHz

Is there a way to include more cpus?

The name is irrelevant, it's the capabilities that is wanted. Your CPU have SSE2 so you want the Intel P4 build. Seems at least half the people in the thread missed that.

Share this post


Link to post
Share on other sites
trancexx

About missing things, the results for me are:

  • 0, 1, 1 - x64 Autoit
  • 1, 1, 1 - x86 Autoit
I don't have Intel's processor.

Be smart and go with CPUID.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Ascend4nt

About missing things, the results for me are:

  • 0, 1, 1 - x64 Autoit
  • 1, 1, 1 - x86 Autoit
I don't have Intel's processor.

Be smart and go with CPUID.

This has to do with the bit-mode you are running in of course. In 64-bit mode, 3DNow and MMX will be reported as unavailable by the O/S because with 64-bit programming they are considered deprecated:

MSDN:

The x87, MMX, and 3DNow! instruction sets are deprecated in 64-bit modes. The instructions sets are still present for backward compatibility for 32-bit mode; however, to avoid compatibility issues in the future, their use in current and future projects is discouraged.

AMD:

3DNow! instructions are being deprecated and will not be supported in certain upcoming AMD processors. In those processors, the 3DNow! Instructions feature flag bit will not be set.

Current AMD processors support SSE, SSE2 & SSE3, so the check for 'best-mode' for KaFu should go in the order SSE2, SSE, 3DNow. And of course if he's running a 64-bit version of MPlayer, 3DNow shouldn't be used (and probably in general given what AMD says).

If its important to check for AMD vs. Intel, the registry 'VendorIdentifier' key (in the script I posted) will either read 'GenuineIntel' or 'AuthenticAMD' (the same strings CPUID returns), so that's one key way to distinguish CPU's.

Share this post


Link to post
Share on other sites
KaFu

JohnOne and AdmiralAlkex are right :graduated:, for me it's all about determining which of the available MPlayer builds to use. More detailed analysis could be done checking for SSE3 (P5) with IsProcessorFeaturePresent, but that flag seems only available on Vista+ Systems. So a more in depth check of the CPUID would be the way to go.

trancexx hint (even as everything is 32bit only) and Ascend4nt research on the 3DNOW flag

3DNow! instructions are being deprecated and will not be supported in certain upcoming AMD processors. In those processors, the 3DNow! Instructions feature flag bit will not be set.

convinced me it is better to use the CPUID... thanks for all the input ;)!

#AutoIt3Wrapper_UseX64=n
 
#include <Memory.au3>
 
Global $s_CPU_Detected = "Unknown CPU"
Switch _VendorID_from_CPUID()
    Case "AuthenticAMD"
        $s_CPU_Detected = "AMD Athlon"
    Case "GenuineIntel"
        If _IsProcessorFeaturePresent(10) Then
            $s_CPU_Detected = "Intel P4"
        ElseIf _IsProcessorFeaturePresent(6) Then
            $s_CPU_Detected = "Intel P3"
        EndIf
EndSwitch
 
MsgBox(0, "_VendorID_from_CPUID & IsProcessorFeaturePresent", "VendorID from CPUID" & @TAB & _VendorID_from_CPUID() & @CRLF & "SSE" & @TAB & @TAB & @TAB & _IsProcessorFeaturePresent(6) & @CRLF & "SSE2" & @TAB & @TAB & @TAB & _IsProcessorFeaturePresent(10) & @CRLF & @CRLF & "=>" & @TAB & $s_CPU_Detected)
 
Func _IsProcessorFeaturePresent($iFeature)
    #cs
        _IsProcessorFeaturePresent(6) ; PF_XMMI_INSTRUCTIONS_AVAILABLE (SSE)
        _IsProcessorFeaturePresent(10) ; PF_XMMI64_INSTRUCTIONS_AVAILABLE (SSE2)
    #ce
    ; http://msdn.microsoft.com/en-us/library/ms724482%28v=VS.85%29.aspx
    $iRes = DllCall("Kernel32.dll", "int", "IsProcessorFeaturePresent", "DWORD", $iFeature)
    Return $iRes[0]
EndFunc   ;==>_IsProcessorFeaturePresent
 
ConsoleWrite(_VendorID_from_CPUID() & @CRLF)
 
Func _VendorID_from_CPUID()
    ; Extracted from trancexxs code for parsing the CPUID
    ; http://www.autoitscript.com/forum/topic/120314-getting-system-cpu-info/page__view__findpost__p__836097
    ;
    ; Allocating memory with $PAGE_EXECUTE_READWRITE
    Local $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    ; Standard allocation in reserved address
    Local $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)
    Local $tBuffer = DllStructCreate("char[12]")
    Local $pBuffer = DllStructGetPtr($tBuffer)
    DllStructSetData($tCodeBuffer, 1, _
            "0x" & _
            "" & _; 10. SET eax AND CALL
            "B8" & SwapEndian(0) & _                                 ; mov eax, 0
            "0FA2" & _                                             ; cpuid
            "" & _ ; 20. ARRANGE DATA
            "891D" & SwapEndian($pBuffer) & _                       ; mov dword[$pBuffer], ebx
            "8915" & SwapEndian($pBuffer + 4) & _                   ; mov dword[$pBuffer + 4], edx
            "890D" & SwapEndian($pBuffer + 8) & _                   ; mov dword[$pBuffer + 8], ecx
            "" & _ ; 30. RETURN
            "C3" _
            )
    Local $iRet = _RunAtAddress($pRemoteCode)
    If @error Then Return SetError(1, 0, 0)
    _MemVirtualFree($pRemoteCode, 512, $MEM_DECOMMIT)
    Return DllStructGetData($tBuffer, 1)
EndFunc   ;==>_VendorID_from_CPUID
 
Func _RunAtAddress($pCode)
    Local $aCall = DllCall("user32.dll", "dword_ptr", "CallWindowProcW", "ptr", $pCode, "ptr", 0, "dword", 0, "wparam", 0, "lparam", 0)
    If @error Then Return SetError(1, 0, 0)
    Return $aCall[0]
EndFunc   ;==>_RunAtAddress
 
Func SwapEndian($iValue, $iSize = 0)
    If $iSize Then
        Local $sPadd = "00000000"
        Return Hex(BinaryMid($iValue, 1, $iSize)) & StringLeft($sPadd, 2 * ($iSize - BinaryLen($iValue)))
    EndIf
    Return Hex(Binary($iValue))
EndFunc   ;==>SwapEndian
Edited by KaFu

Share this post


Link to post
Share on other sites
Ascend4nt

KaFu, I think you're missing something important here - SSE and SSE2 should perform much better than 3D-Now instructions, so if an AMD chipset supports them, why not install the best-performing version rather than worry about the processor?

Also - the CPUID function you call is much simpler as a one-line Registry read :graduated:

Share this post


Link to post
Share on other sites
KaFu

Of course you're right about the regread, missed that :graduated: ...

Global $s_CPU_Detected = "Unknown CPU"
Switch RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","VendorIdentifier")
    Case "AuthenticAMD"
        $s_CPU_Detected = "AMD Athlon"
    Case "GenuineIntel"
        If _IsProcessorFeaturePresent(10) Then
            $s_CPU_Detected = "Intel P4"
        ElseIf _IsProcessorFeaturePresent(6) Then
            $s_CPU_Detected = "Intel P3"
        EndIf
EndSwitch

MsgBox(0, "_VendorID_from_CPUID & IsProcessorFeaturePresent", "VendorID" & @TAB & @TAB & RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","VendorIdentifier") & @CRLF & "SSE" & @TAB & @TAB & _IsProcessorFeaturePresent(6) & @CRLF & "SSE2" & @TAB & @TAB & _IsProcessorFeaturePresent(10) & @CRLF & @CRLF & "=>" & @TAB & $s_CPU_Detected)

Func _IsProcessorFeaturePresent($iFeature)
    #cs
        _IsProcessorFeaturePresent(6) ; PF_XMMI_INSTRUCTIONS_AVAILABLE (SSE)
        _IsProcessorFeaturePresent(10) ; PF_XMMI64_INSTRUCTIONS_AVAILABLE (SSE2)
    #ce
    ; http://msdn.microsoft.com/en-us/library/ms724482%28v=VS.85%29.aspx
    $iRes = DllCall("Kernel32.dll", "int", "IsProcessorFeaturePresent", "DWORD", $iFeature)
    Return $iRes[0]
EndFunc   ;==>_IsProcessorFeaturePresent

The SSE and SSE2 featureset check is not really about the features themselves but just a way to distinguish between P3 and P4 as MPlayer comes in four builds: Athlon, P3, P4 & RTM (for unknown CPUs). What exactly the differences between the builds are... I dont know ;)...

Share this post


Link to post
Share on other sites
AdmiralAlkex

So SSE was actually never needed? That's confusing. What about 3DNow? AMD dropped it in 2011. Also some older VIA cpu's had 3DNow so they would benefit.

Processors supporting 3DNow!

Share this post


Link to post
Share on other sites
KaFu

So SSE was actually never needed?

In context of my question it is needed to identify that an Intel CPU is at least a P3 (_IsProcessorFeaturePresent(6) ; PF_XMMI_INSTRUCTIONS_AVAILABLE (SSE)).

That's confusing. What about 3DNow? AMD dropped it in 2011. Also some older VIA cpu's had 3DNow so they would benefit.

Yeah, that's why I dropped the query for 3DNow and switched to the regread of the VendorIdentifier key to identify an AMD CPU :graduated:...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×