0

Is there an icc macro that can test whether the CPU support AVX-2 or not?

__AVX2__ doesnt work, btw.

user0002128
  • 2,785
  • 2
  • 23
  • 40
  • You can dump all defined macros, see this thread http://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines – Mike Makuch Aug 22 '13 at 03:11
  • Have you already written/tested your arch-specific code? I would create my own `#define` macro and wrap my code in that, then use a make option or a top-level definitions file to create the real definition based on `#if` and `#ifdef` and other such code. – abiessu Aug 22 '13 at 03:12
  • @abiessu yes, I usually use predefined arch-macro for that kind of stuff, however I cannot find the macro for AVX-2 arch. – user0002128 Aug 22 '13 at 03:14
  • @koodawg: Thats the macro for gcc/g++, I use icc (intel C/C++ compiler). – user0002128 Aug 22 '13 at 03:14
  • I understand that you are looking for a predefined macro, but I think a good practice would be to start by assuming that there isn't one and programming that way, then doing a detailed search through the ICC documentation for predefined macros. – abiessu Aug 22 '13 at 03:17
  • `__AVX2__` works on every compiler I've tested so far (gcc, clang, icc) - what icc version are you using and what command line switches are you passing to it ? – Paul R Aug 26 '13 at 08:04

1 Answers1

2

According to this thread

Generate list of preprocessor macros defined by the compiler

the same -dM works for icc.

Community
  • 1
  • 1
Mike Makuch
  • 1,788
  • 12
  • 15