Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

Code-Beispiel

Code-Beispiele » Kleine Helferlein

Welche Asm-Befehle laufen auf meiner CPU?

Lizenz:Erster Autor:Letzte Bearbeitung:
LGPLRedakteurVolta 03.12.2015

Diese kleine Funktion Asm_support gibt eine Kennziffer zurück die direkt ausgewertet werden kann.
auch mit FB 64 Bit

Function Asm_support() As Long
  ' see also: InstructionSet function www.agner.org/optimize/
  ' return value:
  '  0 = use 80386 instruction set
  '  1 or above = MMX instructions supported
  '  2 or above = conditional move and FCOMI supported
  '  3 or above = SSE (XMM) supported
  '  4 or above = SSE2 supported
  '  5 or above = SSE3 supported
  '  6 or above = SSSE3 supported
  '  7 or above = SSE4.1 supported
  '  8 or above = SSE4.2 supported
  '  9          = VMX supported

  #Ifndef __FB_64BIT__
  Asm
    pushfd  ' detect if CPUID instruction supported
    pop     eax
    btc     eax, 21                ' check if CPUID bit can toggle
    push    eax
    popfd
    pushfd
    pop     ebx
    Xor     ebx, eax
    Xor     eax, eax
    bt      ebx, 21
    jc      L_end  ' CPUID not supported
  End Asm
  #EndIf

  Asm
    cpuid                          ' get number of CPUID functions
    Test    eax, eax
    jz      L_end                  ' function 1 not supported
    mov     eax, 1
    cpuid                          ' get features
    Xor     eax, eax               ' 0
    Test    edx, 1                 ' floating point support
    jz      L_end
    bt      edx, 23                ' MMX support
    jnc     L_end
    Inc     eax                    ' 1
    bt      edx, 15                ' conditional move support
    jnc     L_end
    Inc     eax                    ' 2
    bt      edx, 24                ' FXSAVE support
    jnc     L_end
    bt      edx, 25                ' SSE support
    jnc     L_end
    Inc     eax                    ' 3
    bt      edx, 26                ' SSE2 support
    jnc     L_end
    Inc     eax                    ' 4
    Test    ecx, 1                 ' SSE3 support
    jz      L_end
    Inc     eax                    ' 5
    bt      ecx, 9                 ' SSSE3 support
    jnc     L_end
    Inc     eax                    ' 6
    bt      ecx, 19                ' SSE4.1 support
    jnc     L_end
    Inc     eax                    ' 7
    bt      ecx, 20                ' SSE4.2 support
    jnc     L_end
    Inc     eax                    ' 8
    bt      ecx, 5                 ' VMX support
    jnc     L_end
    Inc     eax                    ' 9
    L_end:
    mov [Function],eax
  End Asm
End Function

Print Asm_support
getkey

Zusätzliche Informationen und Funktionen
  • Das Code-Beispiel wurde am 26.11.2008 von RedakteurVolta angelegt.
  • Die aktuellste Version wurde am 03.12.2015 von RedakteurVolta gespeichert.
  Bearbeiten Bearbeiten  

  Versionen Versionen