rust stdarch

1. 测试

使用最新的rust 1.39.0-nightly版本

TARGET=x86_64-unknown-linux-gnu RUSTFLAGS="-C target-cpu=native" cargo test --target x86_64-unknown-linux-gnu -- --nocapture

当在我的Ubuntu16.04虚拟机内运行时,compare_with_cupid() (对应的库为https://github.com/shepmaster/cupid/
)某些test失败的原因是:
其实两者都是调用__cpuid_count来获取底层CPU信息,不同之处在于:stdarch/crates/std_detect/src/detect/os/x86.rs中的detect_features()函数根据不同的信息,对相应的feature位进行了人为判断enable。调整主要依据见(/// [wiki_cpuid]: https://en.wikipedia.org/wiki/CPUID
/// [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
/// [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf)

虚拟机内运行不通过的指令集有:fma、bmi1、bmi2、xsaveopt、xsavec、xsaves、adx。

2. __cpuid_count返回的eax,ebx,ecx,edx含义

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3. horizontal和vertical计算性能对比

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参考资料:
[1] https://github.com/shepmaster/cupid/
[2] https://en.wikipedia.org/wiki/CPUID
[3] https://doc.rust-lang.org/1.27.2/core/arch/x86_64/fn.__cpuid_count.html
[4] http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
[5] http://support.amd.com/TechDocs/24594.pdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值