Upgrade to cupid 0.0.5 and cleanup duplicated code in x86 run-time (#203)

* [ci] upgrade to cupid 0.0.5

* [runtime x86] cleanup duplicated code
This commit is contained in:
gnzlbg 2017-11-21 15:46:36 +01:00 committed by Alex Crichton
parent f236ef8f6b
commit bd629147a1
4 changed files with 26 additions and 32 deletions

View file

@ -28,7 +28,7 @@ opt-level = 3
[dev-dependencies]
stdsimd-test = { version = "0.*", path = "stdsimd-test" }
cupid = "0.4.0"
cupid = "0.5.0"
[features]
std = []

View file

@ -3,7 +3,8 @@
//! These intrinsics form the foundation of the CUDA
//! programming model.
//!
//! The reference is the [CUDA C Programming Guide][cuda_c]. Relevant is also the [LLVM NVPTX Backend documentation][llvm_docs].
//! The reference is the [CUDA C Programming Guide][cuda_c]. Relevant is also
//! the [LLVM NVPTX Backend documentation][llvm_docs].
//!
//! [cuda_c]:
//! http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html

View file

@ -140,14 +140,6 @@ macro_rules! __unstable_detect_feature {
$crate::vendor::__unstable_detect_feature(
$crate::vendor::__Feature::xsaveopt{})
};
("xsave") => {
$crate::vendor::__unstable_detect_feature(
$crate::vendor::__Feature::xsave{})
};
("xsaveopt") => {
$crate::vendor::__unstable_detect_feature(
$crate::vendor::__Feature::xsaveopt{})
};
("xsaves") => {
$crate::vendor::__unstable_detect_feature(
$crate::vendor::__Feature::xsaves{})
@ -265,9 +257,9 @@ pub fn detect_features() -> usize {
// leaf value for subsequent calls of `cpuinfo` in range [0,
// 0x8000_0000]. - The vendor ID is stored in 12 u8 ascii chars,
// returned in EBX, EDX, and ECX (in that order):
let (max_leaf, vendor_id) = unsafe {
let (max_basic_leaf, vendor_id) = unsafe {
let CpuidResult {
eax: max_leaf,
eax: max_basic_leaf,
ebx,
ecx,
edx,
@ -278,10 +270,10 @@ pub fn detect_features() -> usize {
mem::transmute(ecx),
];
let vendor_id: [u8; 12] = mem::transmute(vendor_id);
(max_leaf, vendor_id)
(max_basic_leaf, vendor_id)
};
if max_leaf < 1 {
if max_basic_leaf < 1 {
// Earlier Intel 486, CPUID not implemented
return value;
}
@ -296,7 +288,8 @@ pub fn detect_features() -> usize {
// EAX = 7, ECX = 0: Queries "Extended Features";
// Contains information about bmi,bmi2, and avx2 support.
let (extended_features_ebx, extended_features_ecx) = if max_leaf >= 7 {
let (extended_features_ebx, extended_features_ecx) = if max_basic_leaf >= 7
{
let CpuidResult { ebx, ecx, .. } = unsafe { __cpuid(0x0000_0007_u32) };
(ebx, ecx)
} else {
@ -307,13 +300,13 @@ pub fn detect_features() -> usize {
// - EAX returns the max leaf value for extended information, that is,
// `cpuid` calls in range [0x8000_0000; u32::MAX]:
let CpuidResult {
eax: extended_max_leaf,
eax: extended_max_basic_leaf,
..
} = unsafe { __cpuid(0x8000_0000_u32) };
// EAX = 0x8000_0001, ECX=0: Queries "Extended Processor Info and Feature
// Bits"
let extended_proc_info_ecx = if extended_max_leaf >= 1 {
let extended_proc_info_ecx = if extended_max_basic_leaf >= 1 {
let CpuidResult { ecx, .. } = unsafe { __cpuid(0x8000_0001_u32) };
ecx
} else {
@ -393,7 +386,7 @@ pub fn detect_features() -> usize {
// Processor Extended State Enumeration Sub-leaf (EAX = 0DH, ECX =
// 1)
if max_leaf >= 0xd {
if max_basic_leaf >= 0xd {
let CpuidResult {
eax: proc_extended_state1_eax,
..

View file

@ -20,24 +20,24 @@ fn works() {
assert_eq!(cfg_feature_enabled!("sse4.2"), information.sse4_2());
assert_eq!(cfg_feature_enabled!("avx"), information.avx());
assert_eq!(cfg_feature_enabled!("avx2"), information.avx2());
// assert_eq!(cfg_feature_enabled!("avx512f"), information.avx512f());
// assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
// assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
// assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
// assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
// assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
// assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
// assert_eq!(cfg_feature_enabled!("avx512ifma"),
// information.avx512_ifma());
// assert_eq!(cfg_feature_enabled!("avx512vbmi"),
// information.avx512_vbmi());
// assert_eq!(cfg_feature_enabled!("avx512vpopcntdq"),
// information.avx512_vpopcntdq());
assert_eq!(cfg_feature_enabled!("avx512f"), information.avx512f());
assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
assert_eq!(cfg_feature_enabled!("avx512ifma"), information.avx512_ifma());
assert_eq!(cfg_feature_enabled!("avx512vbmi"), information.avx512_vbmi());
assert_eq!(
cfg_feature_enabled!("avx512vpopcntdq"),
information.avx512_vpopcntdq()
);
assert_eq!(cfg_feature_enabled!("fma"), information.fma());
assert_eq!(cfg_feature_enabled!("bmi"), information.bmi1());
assert_eq!(cfg_feature_enabled!("bmi2"), information.bmi2());
assert_eq!(cfg_feature_enabled!("popcnt"), information.popcnt());
// assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());