Home > Mobile >  What is the /d2vzeroupper MSVC compiler optimization flag doing?
What is the /d2vzeroupper MSVC compiler optimization flag doing?

Time:09-25

What is the /d2vzeroupper MSVC compiler optimization flag doing?

I was reading through this Compiler Options Quick Reference Guide for Epyc CPUs from AMD: https://developer.amd.com/wordpress/media/2020/04/Compiler Options Quick Ref Guide for AMD EPYC 7xx2 Series Processors.pdf

For MSVC, to "Optimize for 64-bit AMD processors", they recommend to enable /favor:AMD64 /d2vzeroupper.

What /favor:AMD64 is doing is clear, there is documentation about that in the MSVC docs. But I can't seem to find /d2vzeroupper being mentioned anywhere in the internet at all, no documentation anywhere. What is it doing?

CodePudding user response:

It enables compiler-generated vzeroupper. See Do I need to use _mm256_zeroupper in 2021?

Normally it is by default. You can disable it by /d2vzeroupper-. See here: https://godbolt.org/z/P48crzTrb

/favor:AMD64 switch suppresses vzeroupper, so /d2vzeroupper enables it back.

  • Related