- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On Windows 10 64 bit, I'm using the Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2022.1.0 Build 20220316 to compile a C++ application.
The computer that the application is going to be compiled on is the only one that this application is going to run on so I know exactly which Intel processor [IvyBridge] this application will run on. I want the compiler to generate optimizations for this particular processor, but, I do not want the compiler to generate AVX instructions.
What compiler option should I use? Between /arch and /Qx, I'm confused which to use.
LLVM has the -mprefer-vector-width option that limits the width of generated vector instructions so compiling with -mprefer-vector-width=128 along with specifying the processor in the -mcpu option will not use AVX. Is there a corresponding compiler option to specify this in the oneAPI DPC++/C++ Compiler.
TIA!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting in the Intel forums.
>>"What compiler option should I use? Between /arch and /Qx, I'm confused which to use."
It is recommended to use the /Qx option as you want the compiler to target a specific Intel processor(ivybridge) & generate optimizations.
- /Qx option tells the compiler which processor features it may target, including which instruction sets and optimizations it may generate.
- /Qax option tells the compiler to generate multiple, feature-specific auto-dispatch code paths for Intel® processors if there is a performance benefit.
Hence we recommend you use /Qxivybridge & /Qaxsse4.2 options together to target specific processor features(Ex: ivybridge) and to generate optimizations using a specific instruction set(Ex: sse4.2).
Thanks & Regards,
Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Santosh:
Sorry for the late update but I wanted to be sure that the compiler flags that you recommended did indeed generate SSE4.2 instructions and not AVX instructions.
I first turned off AVX in the Windows kernel by: bcdedit /set xsavedisable 1
The exe compiled with /Qxivybridge & /Qaxsse4.2 crashed with an "Illegal instruction...." error message - this told me that probably AVX instructions were still generated by the compiler with these compiler switches and hence the error.
Turning on AVX in the Windows kernel by: "bcdedit /set xsavedisable 0" and running the exe worked fine.
I then found a post by Agner Fog who wrote about the Intel "LLVM based" compiler and who also wrote about using the /QxINSTRUCTIONSET switch to target a particular instruction set.
I then used the /QxSSE4.2 compiler switch to target SSE4.2 and also used the /tune:ivybridge compiler switch to perform optimizations for IvyBridge. The exe worked perfectly with AVX turned off in the Windows kernel.
Thanks for your previous response to my question and you may mark this as "resolved".
Regards,
Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Keith,
Glad to know that your issue is resolved. Thanks for sharing the solution with us. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Santosh

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page