Skip to content

Commit df54eac

Browse files
committed
Update stdsimd-verify to print out instruction differences
Too many to deal with for now...
1 parent 68542d9 commit df54eac

File tree

4 files changed

+23
-29
lines changed

4 files changed

+23
-29
lines changed

coresimd/src/x86/i586/sse2.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ pub unsafe fn _mm_storel_pd(mem_addr: *mut f64, a: __m128d) {
20092009
/// into both elements of returned vector.
20102010
#[inline(always)]
20112011
#[target_feature(enable = "sse2")]
2012-
//#[cfg_attr(test, assert_instr(movapd))] FIXME movapd expected
2012+
// #[cfg_attr(test, assert_instr(movapd))] // FIXME LLVM uses different codegen
20132013
pub unsafe fn _mm_load1_pd(mem_addr: *const f64) -> __m128d {
20142014
let d = *mem_addr;
20152015
_mm_setr_pd(d, d)
@@ -2019,10 +2019,9 @@ pub unsafe fn _mm_load1_pd(mem_addr: *const f64) -> __m128d {
20192019
/// into both elements of returned vector.
20202020
#[inline(always)]
20212021
#[target_feature(enable = "sse2")]
2022-
//#[cfg_attr(test, assert_instr(movapd))] FIXME movapd expected
2022+
// #[cfg_attr(test, assert_instr(movapd))] // FIXME same as _mm_load1_pd
20232023
pub unsafe fn _mm_load_pd1(mem_addr: *const f64) -> __m128d {
2024-
let d = *mem_addr;
2025-
_mm_setr_pd(d, d)
2024+
_mm_load1_pd(mem_addr)
20262025
}
20272026

20282027
/// Load 2 double-precision (64-bit) floating-point elements from memory into

coresimd/src/x86/x86_64/sse2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ pub unsafe fn _mm_cvttsd_si64x(a: __m128d) -> i64 {
5353
/// used again soon).
5454
#[inline(always)]
5555
#[target_feature(enable = "sse2")]
56-
// FIXME movnti on windows and linux x86_64
57-
//#[cfg_attr(test, assert_instr(movntiq))]
56+
#[cfg_attr(test, assert_instr(movnti))]
5857
pub unsafe fn _mm_stream_si64(mem_addr: *mut i64, a: i64) {
5958
::core::intrinsics::nontemporal_store(mem_addr, a);
6059
}

stdsimd-verify/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<syn::Ident> {
181181
.filter_map(|a| match a {
182182
syn::Meta::List(i) => {
183183
if i.ident == "cfg_attr" {
184-
i.nested.into_iter().next()
184+
i.nested.into_iter().nth(1)
185185
} else {
186186
None
187187
}

stdsimd-verify/tests/x86-intel.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct Parameter {
7878
#[serde(rename = "type")] type_: String,
7979
}
8080

81-
#[derive(Deserialize)]
81+
#[derive(Deserialize, Debug)]
8282
struct Instruction {
8383
name: String,
8484
}
@@ -166,27 +166,23 @@ fn verify_all_signatures() {
166166
);
167167
}
168168

169-
// TODO: we should test this, but it generates too many failures right
170-
// now
171-
if false {
172-
if rust.instrs.is_empty() {
173-
assert_eq!(
174-
intel.instruction.len(),
175-
0,
176-
"instruction not listed for {}",
177-
rust.name
178-
);
179-
180-
// If intel doesn't list any instructions and we do then don't
181-
// bother trying to look for instructions in intel, we've just got
182-
// some extra assertions on our end.
183-
} else if !intel.instruction.is_empty() {
184-
for instr in rust.instrs {
185-
assert!(
186-
intel
187-
.instruction
188-
.iter()
189-
.any(|a| a.name.starts_with(instr)),
169+
if rust.instrs.is_empty() {
170+
if intel.instruction.len() > 0 {
171+
println!("instruction not listed for `{}`, but intel lists {:?}",
172+
rust.name, intel.instruction);
173+
}
174+
175+
// If intel doesn't list any instructions and we do then don't
176+
// bother trying to look for instructions in intel, we've just got
177+
// some extra assertions on our end.
178+
} else if !intel.instruction.is_empty() {
179+
for instr in rust.instrs {
180+
let asserting = intel
181+
.instruction
182+
.iter()
183+
.any(|a| a.name.starts_with(instr));
184+
if !asserting {
185+
println!(
190186
"intel failed to list `{}` as an instruction for `{}`",
191187
instr,
192188
rust.name

0 commit comments

Comments
 (0)