我尝试了 /Qvec-report:2 选项来查看 MSVC 自动矢量化器是否有用。不幸的是,我没有得到任何结果,无论是正面的还是负面的:
> Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x86
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> cl /c /Zi /nologo- /W3 /WX- /O2 /Ob2 /Oi /Oy /GL /D WIN32 /D _SCL_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D NDEBUG /D _LIB /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /arch:SSE2 /fp:fast /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Release\(redacted).pch" /Fo"Release\\" /Fd"Release\vc110.pdb" /Gd /TP /analyze- /errorReport:prompt /Qvec-report:2 (redacted).cpp
1>cl : Command line warning D9035: option 'nologo-' has been deprecated and will be removed in a future release
1>
1> (redacted).cpp
1>
1>Build succeeded.
我希望收到类似于
--- Analyzing function: main
c:\source.cpp(4) : loop vectorized
c:\source.cpp(5) : loop not vectorized due to reason '1200'