07-24-2023, 12:04 PM
MSVC and ICC both support the intrinsics `_addcarry_u64` and `_addcarryx_u64`.
According to [Intel's Intrinsic Guide](
<s>Additionally, telling the compiler to enable AVX2 with `/arch:AVX2` in [MSVC](
I'm not sure how to enable ADX with MSVC and ICC.
The [documentation for MSVC](
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.
According to [Intel's Intrinsic Guide](
[To see links please register here]
) and [white paper]([To see links please register here]
) 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`.<s>Additionally, telling the compiler to enable AVX2 with `/arch:AVX2` in [MSVC](
[To see links please register here]
) or `-march=core-avx2` with ICC on Linux makes no difference.</s>I'm not sure how to enable ADX with MSVC and ICC.
The [documentation for MSVC](
[To see links please register here]
) 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.