Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Correct way to use /Qax?

Alex_K_6
Beginner
378 Views
Which is the correct way to use the /Qax flag if I want to use SSE2,SSE3,SSSE3,SSE4.1,SSE4.2 and AVX?

This way:
/QaxSSE2,SSE3,SSSE3,SSE4.1,SSE4.2,AVX
or this way:
/QaxAVX

Or is there no difference?
0 Kudos
1 Solution
TimP
Honored Contributor III
378 Views
/QaxAVX should generate code optimized for SSE2 and AVX-256, using 2 separate code paths where the compiler sees an advantage in it.
If you ask for the 6 different optimizations, the compiler would probably choose at most 3 of them, ideally skipping those which don't have any advantage over another, function by function. So, it's just possible the compiler may choose the same 1 or 2 paths either way. If too many are implemented, you would likely lose more from increased code size than you gain on any individual architecture.
If you never intend to run on a CPU which doesn't support SSE3, you could set
/QaxAVX /arch:SSE3 in order to optimize with just those 2 instruction sets, and support non-Intel CPUs which have SSE3.
You could check which of your files can see an advantage from the newer instruction sets and avoid requesting newer code unnecessarily. In my experience, SSE4.2 rarely shows any advantage.

View solution in original post

0 Kudos
1 Reply
TimP
Honored Contributor III
379 Views
/QaxAVX should generate code optimized for SSE2 and AVX-256, using 2 separate code paths where the compiler sees an advantage in it.
If you ask for the 6 different optimizations, the compiler would probably choose at most 3 of them, ideally skipping those which don't have any advantage over another, function by function. So, it's just possible the compiler may choose the same 1 or 2 paths either way. If too many are implemented, you would likely lose more from increased code size than you gain on any individual architecture.
If you never intend to run on a CPU which doesn't support SSE3, you could set
/QaxAVX /arch:SSE3 in order to optimize with just those 2 instruction sets, and support non-Intel CPUs which have SSE3.
You could check which of your files can see an advantage from the newer instruction sets and avoid requesting newer code unnecessarily. In my experience, SSE4.2 rarely shows any advantage.
0 Kudos
Reply