Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/media/libjpeg/simd/i386/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Impressum jsimdcpu.asm   Sprache: Masm

 
;
; jsimdcpu.asm - SIMD instruction support check
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright (C) 2016, D. R. Commander.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler) or Yasm.

%include "jsimdext.inc"

; --------------------------------------------------------------------------
    SECTION     SEG_TEXT
    BITS        32
;
; Check if the CPU supports SIMD instructions
;
; GLOBAL(unsigned int)
; jpeg_simd_cpu_support(void)
;

    align       32
    GLOBAL_FUNCTION(jpeg_simd_cpu_support)

EXTN(jpeg_simd_cpu_support):
    push        ebx
;   push        ecx                     ; need not be preserved
;   push        edx                     ; need not be preserved
;   push        esi                     ; unused
    push        edi

    xor         ediedi                ; simd support flag

    pushfd
    pop         eax
    mov         edxeax
    xor         eax, 1<<21              ; flip ID bit in EFLAGS
    push        eax
    popfd
    pushfd
    pop         eax
    xor         eaxedx
    jz          near .return            ; CPUID is not supported

    ; Check whether CPUID leaf 07H is supported
    ; (leaf 07H is used to check for AVX2 instruction support)
    xor         eaxeax
    cpuid
    test        eaxeax
    jz          near .return
    cmp         eax, 7
    jl          short .no_avx2          ; Maximum leaf < 07H

    ; Check for AVX2 instruction support
    mov         eax, 7
    xor         ecxecx
    cpuid
    mov         eax, ebx
    test        eax, 1<<5               ; bit5:AVX2
    jz          short .no_avx2

    ; Check for AVX2 O/S support
    mov         eax, 1
    xor         ecxecx
    cpuid
    test        ecx, 1<<27
    jz          short .no_avx2          ; O/S does not support XSAVE
    test        ecx, 1<<28
    jz          short .no_avx2          ; CPU does not support AVX2

    xor         ecxecx
    xgetbv
    and         eax, 6
    cmp         eax, 6                  ; O/S does not manage XMM/YMM state
                                        ; using XSAVE
    jnz         short .no_avx2

    or          edi, JSIMD_AVX2
.no_avx2:

    ; Check CPUID leaf 01H for MMX, SSE, and SSE2 support
    xor         eaxeax
    inc         eax
    cpuid
    mov         eaxedx                ; eax = Standard feature flags

    ; Check for MMX instruction support
    test        eax, 1<<23              ; bit23:MMX
    jz          short .no_mmx
    or          edibyte JSIMD_MMX
.no_mmx:
    test        eax, 1<<25              ; bit25:SSE
    jz          short .no_sse
    or          edibyte JSIMD_SSE
.no_sse:
    test        eax, 1<<26              ; bit26:SSE2
    jz          short .no_sse2
    or          edibyte JSIMD_SSE2
.no_sse2:

    ; Check for 3DNow! instruction support
    mov         eax, 0x80000000
    cpuid
    cmp         eax, 0x80000000
    jbe         short .return

    mov         eax, 0x80000001
    cpuid
    mov         eaxedx                ; eax = Extended feature flags

    test        eax, 1<<31              ; bit31:3DNow!(vendor independent)
    jz          short .no_3dnow
    or          edibyte JSIMD_3DNOW
.no_3dnow:

.return:
    mov         eaxedi

    pop         edi
;   pop         esi                     ; unused
;   pop         edx                     ; need not be preserved
;   pop         ecx                     ; need not be preserved
    pop         ebx
    ret

; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
    align       32

Messung V0.5
C=64 H=81 G=72

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:  (vorverarbeitet)  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.