Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Correct way to use /Qax?

Alex_K_6
Beginner
157 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
Black Belt
157 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

1 Reply
TimP
Black Belt
158 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.
Reply