Closed
Description
The following code triggers an assertion, which checks if !(==) is the same as !=.
In this case the issue only occurs when there are different values in the vector. The current tests only check that PartialEq
is working in the splat
against splat
case, which it does work correctly. However when there is a different value in the vector (non-splatted), PartialEq
is incorrect.
This issue also occurs when using u32x4
and mask values. It does not seem to be an issue with just the 512-bit emulation.
Tests should also be expanded to test non-splatted cases.
#![feature(stdsimd)]
use std::simd::u32x16;
fn main() {
let foo = u32x16::new(
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
);
let target = u32x16::splat(1);
print!("Are they different? {}\n", foo != target);
print!("Are they equal? {}\n", foo == target);
assert!((foo != target) == !(foo == target));
}
This will result in
Standard Error
Compiling playground v0.0.1 (file:///playground)
Finished dev [unoptimized + debuginfo] target(s) in 1.31s
Running `target/debug/playground`
thread 'main' panicked at 'assertion failed: (foo != target) == !(foo == target)', src/main.rs:15:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Standard Output
Are they different? false
Are they equal? false
https://play.rust-lang.org/?gist=9e0799d170e488b7c691b6f98ccc72ca&version=nightly&mode=debug
-B
Metadata
Metadata
Assignees
Labels
No labels