Skip to content

Commit 0187bd0

Browse files
Test core::simd works
These tests just verify some basic APIs of core::simd function, and guarantees that attempting to access the wrong things doesn't work. The majority of tests are stochastic, and so remain upstream, but a few deterministic tests arrive in the subtree as doc tests.
1 parent 11bbbe5 commit 0187bd0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

core/tests/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#![feature(unwrap_infallible)]
6363
#![feature(option_result_unwrap_unchecked)]
6464
#![feature(result_into_ok_or_err)]
65+
#![cfg_attr(not(bootstrap), feature(portable_simd))]
6566
#![feature(ptr_metadata)]
6667
#![feature(once_cell)]
6768
#![feature(unsized_tuple_coercion)]
@@ -104,6 +105,8 @@ mod pattern;
104105
mod pin;
105106
mod ptr;
106107
mod result;
108+
#[cfg(not(bootstrap))]
109+
mod simd;
107110
mod slice;
108111
mod str;
109112
mod str_lossy;

core/tests/simd.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use core::simd::f32x4;
2+
3+
#[test]
4+
fn testing() {
5+
let x = f32x4::from_array([1.0, 1.0, 1.0, 1.0]);
6+
let y = -x;
7+
8+
let h = x * 0.5;
9+
10+
let r = y.abs();
11+
assert_eq!(x, r);
12+
assert_eq!(h, f32x4::splat(0.5));
13+
}

0 commit comments

Comments
 (0)