_addcarry_u64和_addcarryx_u64与MSVC和ICC [英] _addcarry_u64 and _addcarryx_u64 with MSVC and ICC

查看:994
本文介绍了_addcarry_u64和_addcarryx_u64与MSVC和ICC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSVC和ICC都支持内在 _addcarry_u64 _addcarryx_u64

MSVC and ICC both support the intrinsics _addcarry_u64 and _addcarryx_u64.

根据英特尔的内在指南和<一个href=\"http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/ia-large-integer-arithmetic-paper.html\"相对=nofollow>白皮书这些应该映射到使用ADCx ADOX C>和。然而,通过查看生成的程序集很明显它们映射到 ADC 使用ADCx 分别并没有内在它映射到 ADOX

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.

另外,告诉编译器,以使与AVX2 /弓:AVX2 在<一个href=\"http://blogs.msdn.com/b/vcblog/archive/2014/02/28/avx2-support-in-visual-studio-c-compiler.aspx\"相对=nofollow> MSVC 或 -march =核心AVX2 没什么区别。
 我不知道如何启用ADX与MSVC和ICC。

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.

有关MSVC的文档名单 _addcarryx_u64 与ADX的技术,而 _addcarry_u64 还没有上市的技术。然而,对于这些内在MSVC的文档中的链接直接进入英特尔固有导这违背MSVC自己的文档和生成的程序集。

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.

这有一定道理的MSVC意义上它不允许内联汇编它应该提供一种方式来使用 ADC 它与 _addcarry_u64

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.

一个使用ADCx ADOX 的是,他们在不同的标志进行操作(执行<$ C的一大优点$ C> CF 和溢出),这使得两个独立平行进位链。但是,由于没有用于 ADOX 没有内在的,这怎么可能?随着国际刑事法院至少有一个可以使用内联汇编,但这是不可能的MSVC在64位模式。

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.

_addcarry_u64 内在文件说只生产 ADC 。在 _addcarryx_u64 内在可以生成使用ADCx ADOX 。随着MSVC 2013年和2015年,然而, _addcarryx_u64 只生产使用ADCx 。 ICC既产生。

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.

推荐答案

它们映射到 ADC 使用ADCx 键, ADOX 。编译器指令决定使用哪个,根据您如何使用它们。如果你在并行执行两个大-INT增加编译器将使用使用ADCx ADOX ,为更高的吞吐量。例如:

They map to adc, adcx AND adox. The compiler decides which instructions to use, based on how you use them. If you perform two big-int additions in parallel the compiler will use adcx and adox, for higher throughput. For example:

unsigned char c1 = 0, c2 = 0
for(i=0; i< 100; i++){ 
    c1 = _addcarry_u64(c1, res[i], a[i], &res[i]);
    c2 = _addcarry_u64(c2, res[i], b[i], &res[i]);
}

这篇关于_addcarry_u64和_addcarryx_u64与MSVC和ICC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆