Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

How to avoid unsupported instructions?

SDeut
Beginner
669 Views

I compile this inline asm line with Intel compiler:

_asm
{
  vpxor  ymm0, ymm0, ymm0
}

compiles ok, but is an AVX2 instruction, that will not run on my older i5 CPU and give an illegal instruction exception.

How can I tell the compiler to disable specific SIMD instructions? E.g. like this: /disable:AVX2 ?

0 Kudos
2 Replies
TimP
Honored Contributor III
669 Views

You might consider the processor dispatching feature, or avx compatible intrinsic which might be promoted according to /arch:

Or guarding with #if __AVX2__

0 Kudos
areid2
New Contributor I
669 Views

The Intel compiler has a number of options to control the instruction sets to target and possibly generate multiple auto-dispatch code paths for different different processors, but that only applies to compiling C/C++ code:

https://software.intel.com/en-us/node/522821

When you compile inline assembly you are specifying the exact instructions to use in the object files. I'm not aware of any Intel tools to translate instructions at the assembly level. You'll likely have to modify the code in one of the ways Tim suggested above in order to avoid the AVX instructions.

0 Kudos
Reply