crypto/sha1: add real workaround for msvc/arm64 bad codegen

This commit is contained in:
Shawn Hoffman 2022-08-02 23:05:45 -07:00
parent 78142e30cc
commit bf5076eb01
3 changed files with 14 additions and 5 deletions

View file

@ -136,6 +136,14 @@ add_library(common
WorkQueueThread.h
)
if(MSVC AND _M_ARM_64)
# Workaround msvc arm64 optimizer bug
# TODO remove after updating to VS 17.4
set_source_files_properties(
Crypto/SHA1.cpp
PROPERTIES COMPILE_FLAGS "/d2ssa-peeps-post-color-")
endif()
if(NOT MSVC AND _M_ARM_64)
set_source_files_properties(
Crypto/AES.cpp

View file

@ -293,10 +293,6 @@ private:
template <size_t Func>
static inline constexpr State FourRounds(State state, uint32x4_t w)
{
#ifdef _MSC_VER
// FIXME it seems the msvc optimizer gets a little too happy
_ReadBarrier();
#endif
return {f<Func>(state, w), vsha1h_u32(vgetq_lane_u32(state.abcd, 0))};
}

View file

@ -723,7 +723,12 @@
<ClCompile Include="Common\Crypto\AES.cpp" />
<ClCompile Include="Common\Crypto\bn.cpp" />
<ClCompile Include="Common\Crypto\ec.cpp" />
<ClCompile Include="Common\Crypto\SHA1.cpp" />
<ClCompile Include="Common\Crypto\SHA1.cpp">
<!--Workaround msvc arm64 optimizer bug
TODO remove after updating to VS 17.4
-->
<AdditionalOptions Condition="'$(Platform)'=='ARM64'">/d2ssa-peeps-post-color- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="Common\Debug\MemoryPatches.cpp" />
<ClCompile Include="Common\Debug\Watches.cpp" />
<ClCompile Include="Common\DynamicLibrary.cpp" />