Skip to content

Commit

Permalink
Auto merge of #2003 - RalfJung:simd-reduce-test, r=RalfJung
Browse files Browse the repository at this point in the history
also test f32/f64 simd_reduce

Forgot to include this in #2001
  • Loading branch information
bors committed Mar 6, 2022
2 parents 176f070 + 21d36ff commit a25d905
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/run-pass/portable-simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ fn simd_ops_f32() {
assert_eq!(a.lanes_lt(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([0, 0, -1, 0])));
assert_eq!(a.lanes_ge(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([-1, -1, 0, -1])));
assert_eq!(a.lanes_gt(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([-1, 0, 0, -1])));

assert_eq!(a.horizontal_sum(), 40.0);
assert_eq!(b.horizontal_sum(), 2.0);
assert_eq!(a.horizontal_product(), 100.0*100.0);
assert_eq!(b.horizontal_product(), -24.0);
}

fn simd_ops_f64() {
Expand All @@ -41,6 +46,11 @@ fn simd_ops_f64() {
assert_eq!(a.lanes_lt(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([0, 0, -1, 0])));
assert_eq!(a.lanes_ge(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([-1, -1, 0, -1])));
assert_eq!(a.lanes_gt(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([-1, 0, 0, -1])));

assert_eq!(a.horizontal_sum(), 40.0);
assert_eq!(b.horizontal_sum(), 2.0);
assert_eq!(a.horizontal_product(), 100.0*100.0);
assert_eq!(b.horizontal_product(), -24.0);
}

fn simd_ops_i32() {
Expand Down Expand Up @@ -78,7 +88,7 @@ fn simd_ops_i32() {
assert_eq!(a.horizontal_sum(), 40);
assert_eq!(b.horizontal_sum(), 2);
assert_eq!(a.horizontal_product(), 100*100);
assert_eq!(b.horizontal_product(), 6*-4);
assert_eq!(b.horizontal_product(), -24);
}

fn simd_intrinsics() {
Expand Down

0 comments on commit a25d905

Please sign in to comment.