123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- %include "jsimdext.inc"
- SECTION SEG_TEXT
- BITS 32
- align 32
- GLOBAL_FUNCTION(jpeg_simd_cpu_support)
- EXTN(jpeg_simd_cpu_support):
- push ebx
- push edi
- xor edi, edi
- pushfd
- pop eax
- mov edx, eax
- xor eax, 1<<21
- push eax
- popfd
- pushfd
- pop eax
- xor eax, edx
- jz near .return
-
-
- xor eax, eax
- cpuid
- test eax, eax
- jz near .return
- cmp eax, 7
- jl short .no_avx2
-
- mov eax, 7
- xor ecx, ecx
- cpuid
- mov eax, ebx
- test eax, 1<<5
- jz short .no_avx2
-
- mov eax, 1
- xor ecx, ecx
- cpuid
- test ecx, 1<<27
- jz short .no_avx2
- test ecx, 1<<28
- jz short .no_avx2
- xor ecx, ecx
- xgetbv
- and eax, 6
- cmp eax, 6
-
- jnz short .no_avx2
- or edi, JSIMD_AVX2
- .no_avx2:
-
- xor eax, eax
- inc eax
- cpuid
- mov eax, edx
-
- test eax, 1<<23
- jz short .no_mmx
- or edi, byte JSIMD_MMX
- .no_mmx:
- test eax, 1<<25
- jz short .no_sse
- or edi, byte JSIMD_SSE
- .no_sse:
- test eax, 1<<26
- jz short .no_sse2
- or edi, byte JSIMD_SSE2
- .no_sse2:
-
- mov eax, 0x80000000
- cpuid
- cmp eax, 0x80000000
- jbe short .return
- mov eax, 0x80000001
- cpuid
- mov eax, edx
- test eax, 1<<31
- jz short .no_3dnow
- or edi, byte JSIMD_3DNOW
- .no_3dnow:
- .return:
- mov eax, edi
- pop edi
- pop ebx
- ret
- align 32
|