New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<__msvc_int128.hpp>
: Performance issues
#2520
Comments
<__msvc_int128.hpp>
: Workaround DevCom-1544675<__msvc_int128.hpp>
: Performance issues
These are affected too. |
I've moved these intrinsics in MSVC-PR-381950. We should be able to fixup the includes in |
DevCom-1544675 status: Fixed, Pending Release |
The inclusion of |
DevCom-1544675 status fixed |
Fixed in which version? No tag 'fixed in: xxx' has been added to the DevCom issue and there hasn't been a release today... |
Looks like it was fixed for 17.4 preview 3, but the metadata wasn't set at the time, so the DevCom automation got confused. |
When building with the 17.5.0 preview toolset for MSVC and building with modules, the definition of _addcarry_u64 and _subborrow_u64 seem to cause issues due to the use of GNU inline semantics. Change the headers to prefer C++ inline semantics for C++ compilation, falling back to GNU inlining semantics for C compilation. This is motivated by microsoft/STL#2520. Differential Revision: https://reviews.llvm.org/D139749 Reviewed By: fsb4000
When building with the 17.5.0 preview toolset for MSVC and building with modules, the definition of _addcarry_u64 and _subborrow_u64 seem to cause issues due to the use of GNU inline semantics. Change the headers to prefer C++ inline semantics for C++ compilation, falling back to GNU inlining semantics for C compilation. This is motivated by microsoft/STL#2520. Differential Revision: https://reviews.llvm.org/D139749 Reviewed By: fsb4000 (cherry picked from commit 3b06779)
There are some potenial performance improvements to be made to the 128-bit integer-class types
_Int128
and_Uint128
defined in<__msvc_int128.hpp>
:DevCom-1544675 results in terrible codegen when MSVC fails to fuse a division and modulo operation with equivalent operands into a single assembly instruction. Divides are expensive enough as it is, we don't want to pay double. The CRT'sThe fix for this will ship "soon", it's not worth investing in a workaround.div
andlldiv
are also affected, so we'll need to use_udiv64
/_div64
instead of raw/
and%
when!is_constant_evaluated()
._AddCarry64
/_SubBorrow64
might be more efficient on x64 / arm64 (needs investigation)._mm_and_si128
/_mm_or_si128
/_mm_xor_si128
could probably be used to implement bitops more efficiently at runtime on x64 (presumably arm64 has equivalents).__shiftleft128
,_addcarry_u64
,_subborrow_u64
, and_udiv128
need to be moved fromintrin.h
tointrin0.h
in vcruntime.Thanks to @AlexGuteniev for suggesting all the above.
The text was updated successfully, but these errors were encountered: