; ; jsimdcpu.asm - SIMD instruction support check ; ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB ; Copyright (C) 2016, D. R. Commander. ; Copyright (C) 2023, Aliaksiej Kandracienka. ; ; Based on ; 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 64 ; ; Check if the CPU supports SIMD instructions ; ; GLOBAL(unsigned int) ; jpeg_simd_cpu_support(void) ;
; Check for AVX2 O/S support mov rax, 1 xor rcx, rcx
cpuid
test rcx, 1<<27 jzshort .return ; O/S does not support XSAVE
test rcx, 1<<28 jzshort .return ; CPU does not support AVX2
xor rcx, rcx
xgetbv and rax, 6 cmp rax, 6 ; O/S does not manage XMM/YMM state ; using XSAVE jnzshort .return
or rdi, JSIMD_AVX2
.return: mov rax, rdi
pop rdi pop rbx pop rbp ret
; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. align 32
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.