How to check with Intel intrinsics if AVX extensions is supported by the CPU?

Jan Stolarek

I'm writing a program using Intel intrinsics. I want to use _mm_permute_pd intrinsic, which is only available on CPUs with AVX. For CPUs without AVX I can use _mm_shuffle_pd but according to the specs it is much slower than _mm_permute_pd. Do the header files for Intel intrinsics define constants that allow me to distinguish whether AVX is supported so that I can write sth like this:

#ifdef __IS_AVX_SUPPORTED__  // is there sth like this defined?
// use _mm_permute_pd
# else
// use _mm_shuffle_pd
#endif

? I have found this tutorial, which shows how to perform a runtime check but I need to do a static, compile-time check for the current machine.

vharavy

I assume you are using Intel C++ Compiler. In this case - yes, there are such macros: Intel C++ Compiler Reference Guide: __AVX__, __AVX2__.

P.S. Be aware that if you compile you application with AVX instruction set enabled it will fail on CPUs not supporting AVX. If you are going to distribute your software as source code package and compile on target machine - this is may be a viable solution. Otherwise you should check for AVX dynamically.

P.P.S. There are several options for ICC. Take a look at the following compiler options and also references from it to other.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to check aes-ni are supported by CPU?

From Dev

How to use the Intel AVX in Java?

From Dev

How to check that AES-NI is supported by my CPU?

From Dev

std::array of AVX intrinsics

From Dev

how can I check whether Intel's AVX is enabled on my computer?

From Dev

How to install Intel AVX 2 on Ubuntu

From Dev

Issues with intel intrinsics

From Dev

Intel / ARM intrinsics equivalence

From Dev

Intel Intrinsics code optimization

From Dev

Compress mask using AVX intrinsics

From Dev

Potential bug in Visual Studio C compiler or in Intel Intrinsics' AVX2 "_mm256_set_epi64x" function

From Dev

Arithmetic shift using intel intrinsics

From Dev

Why are some Intel family 6 CPU models (Core 2, Pentium M) not supported by intel_idle?

From Dev

How to enable AVX2 extensions on a Ubuntu guest in VirtualBox 5?

From Dev

Forcing AVX intrinsics to use SSE instructions instead

From Dev

Macro for generating immediates for AVX shuffle intrinsics

From Dev

Fill constant floats in AVX intrinsics vec

From Dev

how to check for certain extensions in php

From Dev

how to check file extensions with an array

From Dev

How to check a css propert is supported?

From Dev

How to check a css propert is supported?

From Dev

How to check the platforms a package is supported?

From Dev

Aligned and unaligned memory access with AVX/AVX2 intrinsics

From Dev

How to check connection in Intel XDK

From Dev

AVX-512 extensions supported on new Skylake-X (Core i9, 79xxX/XE) CPUs

From Dev

How change CPU multiplier on Lenovo Intel processor?

From Dev

How to overclock Intel E2140 CPU?

From Dev

Intel site says VT-x is supported on my CPU, but tests say otherwise

From Dev

How long are piBase extensions going to be supported by TYPO3

Related Related

  1. 1

    How to check aes-ni are supported by CPU?

  2. 2

    How to use the Intel AVX in Java?

  3. 3

    How to check that AES-NI is supported by my CPU?

  4. 4

    std::array of AVX intrinsics

  5. 5

    how can I check whether Intel's AVX is enabled on my computer?

  6. 6

    How to install Intel AVX 2 on Ubuntu

  7. 7

    Issues with intel intrinsics

  8. 8

    Intel / ARM intrinsics equivalence

  9. 9

    Intel Intrinsics code optimization

  10. 10

    Compress mask using AVX intrinsics

  11. 11

    Potential bug in Visual Studio C compiler or in Intel Intrinsics' AVX2 "_mm256_set_epi64x" function

  12. 12

    Arithmetic shift using intel intrinsics

  13. 13

    Why are some Intel family 6 CPU models (Core 2, Pentium M) not supported by intel_idle?

  14. 14

    How to enable AVX2 extensions on a Ubuntu guest in VirtualBox 5?

  15. 15

    Forcing AVX intrinsics to use SSE instructions instead

  16. 16

    Macro for generating immediates for AVX shuffle intrinsics

  17. 17

    Fill constant floats in AVX intrinsics vec

  18. 18

    how to check for certain extensions in php

  19. 19

    how to check file extensions with an array

  20. 20

    How to check a css propert is supported?

  21. 21

    How to check a css propert is supported?

  22. 22

    How to check the platforms a package is supported?

  23. 23

    Aligned and unaligned memory access with AVX/AVX2 intrinsics

  24. 24

    How to check connection in Intel XDK

  25. 25

    AVX-512 extensions supported on new Skylake-X (Core i9, 79xxX/XE) CPUs

  26. 26

    How change CPU multiplier on Lenovo Intel processor?

  27. 27

    How to overclock Intel E2140 CPU?

  28. 28

    Intel site says VT-x is supported on my CPU, but tests say otherwise

  29. 29

    How long are piBase extensions going to be supported by TYPO3

HotTag

Archive