You must check if the emulated processor has support for AVX (or AVX2):
bits 64
default rel
section .text
global supports_avx
global supports_avx2
;
; SysV and MS calling convention mandates RBX must be
; saved between calls. I usualy use asm routines from C functions!
;
supports_avx:
push rbx
mov eax,1
cpuid
xor eax,eax
test ecx,1 << 28
setnz al
pop rbx
ret
supports_avx2:
push rbx
xor ecx,ecx
mov eax,7
cpuid
xor eax,eax
test ebx,1 << 5
setnz al
pop rbx
ret
Here's some features from Intel's Software Development Manuals: