MSVC and ICC both support the intrinsics _addcarry_u64
and _addcarryx_u64
.
According to Intel's Intrinsic Guide and white paper these should map to adcx
and adox
respectively. However, by looking at the generated assembly it's clear they map to adc
and adcx
respectively and there is no intrinsic which maps to adox
.
Additionally, telling the compiler to enable AVX2 with /arch:AVX2
in MSVC or -march=core-avx2
with ICC on Linux makes no difference.
I'm not sure how to enable ADX with MSVC and ICC.
The documentation for MSVC lists _addcarryx_u64
with the technology of ADX whereas _addcarry_u64
has no listed technology. However, the link in MSVC's documentation for these intrinsics goes directly to the Intel Intrinsic guide which contradicts MSVC's own documentation and the generated assembly.
From this I conclude that Intel's Intrinsic guide and white paper are wrong.
This makes some sense for MSVC sense it does not allow inline assembly it should provide a way to use adc
which it does with _addcarry_u64
.
One of the big advantages of adcx
and adox
is that they operate on different flags (carry CF
and overflow OF
) and this allows two independent parallel carry chains. However, since there is no intrinsic for adox
how is this possible? With ICC at least one can use inline assembly but this is not possible with MSVC in 64-bit mode.
Microsoft and Intel's documentation (both the white paper and the intrinsic guide online) both agree now.
The _addcarry_u64
intrinsic documentation says produces only adc
. The _addcarryx_u64
intrinsic can produce either adcx
or adox
. With MSVC 2013 and 2015, however, _addcarryx_u64
only produces adcx
. ICC produces both.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…