1

I know icc/icpc can compile and optimize for multiple architectures using the -ax flag (ex -axsavx,sse2 compiles for both avx and sse2 extensions)

Is there something similar to that with gcc/g++?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
NerdyKoala
  • 25
  • 6
  • Not that I know of; I think GCC's function-multiversioning has to be used manually. – Peter Cordes Dec 09 '22 at 20:31
  • @PeterCordes how so?? – NerdyKoala Dec 09 '22 at 20:46
  • 2
    By using `__attribute__((target("avx2")))` and so on, on certain functions that are worth doing this for and run long enough to be worth adding dynamic dispatch overhead. e.g. [Will it be feasible to use gcc's function multi-versioning without code changes?](https://stackoverflow.com/q/48882796) . Actually that looks like a duplicate of your question. – Peter Cordes Dec 09 '22 at 20:49

0 Answers0