x86avx2illegal-instruction

System claims AVX2 is supported, but broadcasts of integer registers are unimplemented


cat /proc/cpuinfo reports that the avx2 flag is set.

However, the AVX2 instruction vpbroadcastb causes an illegal instruction exception when ran.

I am using x86_64 Linux and nasm as my assembler. On my system, reproducing this is as simple as

global main
main:
vpbroadcastb xmm1, eax

using NASM.

Anyone know anything about this? This is a AMD A12-9700P RADEON R7 APU that i'm using.


Solution

  • vpbroadcastb with a general purpose register as operand requires AVX512. It assembles (with a new enough assembler), but you get an illegal instruction signal on CPUs with only AVX2.

    If your CPU supports AVX2,

    vpbroadcastb xmm1, xmm0
    

    for example, should work.