Skip to content

Commit 1c81797

Browse files
author
Daniel Smith
committed
Merge branch 'moar-avx512f-cmp' into avx-512-cmp
2 parents 45aa0bd + 832166a commit 1c81797

File tree

5 files changed

+112232
-99244
lines changed

5 files changed

+112232
-99244
lines changed

crates/core_arch/src/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ pub mod arch {
5757

5858
/// Platform-specific intrinsics for the `wasm32` platform.
5959
///
60+
61+
/// # Availability
62+
///
63+
/// Note that intrinsics gated by `target_feature = "atomics"` or `target_feature = "simd128"`
64+
/// are only available **when the standard library itself is compiled with the the respective
65+
/// target feature**. This version of the standard library is not obtainable via `rustup`,
66+
/// but rather will require the standard library to be compiled from source.
6067
/// See the [module documentation](../index.html) for more details.
6168
#[cfg(any(target_arch = "wasm32", dox))]
6269
#[doc(cfg(target_arch = "wasm32"))]

crates/core_arch/src/x86/avx2.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,9 +3743,9 @@ pub unsafe fn _mm256_xor_si256(a: __m256i, b: __m256i) -> __m256i {
37433743
// This intrinsic has no corresponding instruction.
37443744
#[rustc_args_required_const(1)]
37453745
#[stable(feature = "simd_x86", since = "1.27.0")]
3746-
pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i8 {
3746+
pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i32 {
37473747
let imm8 = (imm8 & 31) as u32;
3748-
simd_extract(a.as_i8x32(), imm8)
3748+
simd_extract::<_, u8>(a.as_u8x32(), imm8) as i32
37493749
}
37503750

37513751
/// Extracts a 16-bit integer from `a`, selected with `imm8`. Returns a 32-bit
@@ -3759,9 +3759,9 @@ pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i8 {
37593759
// This intrinsic has no corresponding instruction.
37603760
#[rustc_args_required_const(1)]
37613761
#[stable(feature = "simd_x86", since = "1.27.0")]
3762-
pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i16 {
3762+
pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i32 {
37633763
let imm8 = (imm8 & 15) as u32;
3764-
simd_extract(a.as_i16x16(), imm8)
3764+
simd_extract::<_, u16>(a.as_u16x16(), imm8) as i32
37653765
}
37663766

37673767
/// Extracts a 32-bit integer from `a`, selected with `imm8`.
@@ -6115,7 +6115,7 @@ mod tests {
61156115
);
61166116
let r1 = _mm256_extract_epi8(a, 0);
61176117
let r2 = _mm256_extract_epi8(a, 35);
6118-
assert_eq!(r1, -1);
6118+
assert_eq!(r1, 0xFF);
61196119
assert_eq!(r2, 3);
61206120
}
61216121

@@ -6128,7 +6128,7 @@ mod tests {
61286128
);
61296129
let r1 = _mm256_extract_epi16(a, 0);
61306130
let r2 = _mm256_extract_epi16(a, 19);
6131-
assert_eq!(r1, -1);
6131+
assert_eq!(r1, 0xFFFF);
61326132
assert_eq!(r2, 3);
61336133
}
61346134

crates/core_arch/src/x86/sse2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ pub unsafe fn _mm_packus_epi16(a: __m128i, b: __m128i) -> __m128i {
13751375
#[rustc_args_required_const(1)]
13761376
#[stable(feature = "simd_x86", since = "1.27.0")]
13771377
pub unsafe fn _mm_extract_epi16(a: __m128i, imm8: i32) -> i32 {
1378-
simd_extract::<_, i16>(a.as_i16x8(), (imm8 & 7) as u32) as i32
1378+
simd_extract::<_, u16>(a.as_u16x8(), (imm8 & 7) as u32) as i32
13791379
}
13801380

13811381
/// Returns a new vector where the `imm8` element of `a` is replaced with `i`.
@@ -4132,7 +4132,7 @@ mod tests {
41324132
let a = _mm_setr_epi16(-1, 1, 2, 3, 4, 5, 6, 7);
41334133
let r1 = _mm_extract_epi16(a, 0);
41344134
let r2 = _mm_extract_epi16(a, 11);
4135-
assert_eq!(r1, -1);
4135+
assert_eq!(r1, 0xFFFF);
41364136
assert_eq!(r2, 3);
41374137
}
41384138

crates/stdarch-verify/tests/x86-intel.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ struct Data {
9797

9898
#[derive(Deserialize)]
9999
struct Intrinsic {
100-
rettype: String,
100+
#[serde(rename = "return")]
101+
return_: Return,
101102
name: String,
102103
#[serde(rename = "CPUID", default)]
103104
cpuid: Vec<String>,
@@ -113,6 +114,12 @@ struct Parameter {
113114
type_: String,
114115
}
115116

117+
#[derive(Deserialize)]
118+
struct Return {
119+
#[serde(rename = "type")]
120+
type_: String,
121+
}
122+
116123
#[derive(Deserialize, Debug)]
117124
struct Instruction {
118125
name: String,
@@ -506,12 +513,12 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> {
506513

507514
// Make sure we've got the right return type.
508515
if let Some(t) = rust.ret {
509-
equate(t, &intel.rettype, rust.name, false)?;
510-
} else if intel.rettype != "" && intel.rettype != "void" {
516+
equate(t, &intel.return_.type_, rust.name, false)?;
517+
} else if intel.return_.type_ != "" && intel.return_.type_ != "void" {
511518
bail!(
512519
"{} returns `{}` with intel, void in rust",
513520
rust.name,
514-
intel.rettype
521+
intel.return_.type_
515522
)
516523
}
517524

@@ -660,7 +667,7 @@ fn equate(t: &Type, intel: &str, intrinsic: &str, is_const: bool) -> Result<(),
660667

661668
(&Type::MMASK8, "__mmask8") => {}
662669
(&Type::MMASK16, "__mmask16") => {}
663-
(&Type::MM_CMPINT_ENUM, "const _MM_CMPINT_ENUM") => require_const()?,
670+
(&Type::MM_CMPINT_ENUM, "_MM_CMPINT_ENUM") => {}
664671

665672
// This is a macro (?) in C which seems to mutate its arguments, but
666673
// that means that we're taking pointers to arguments in rust

0 commit comments

Comments
 (0)