Skip to content

Commit a25d905

Browse files
committed
Auto merge of #2003 - RalfJung:simd-reduce-test, r=RalfJung
also test f32/f64 simd_reduce Forgot to include this in #2001
2 parents 176f070 + 21d36ff commit a25d905

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/run-pass/portable-simd.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ fn simd_ops_f32() {
2020
assert_eq!(a.lanes_lt(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([0, 0, -1, 0])));
2121
assert_eq!(a.lanes_ge(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([-1, -1, 0, -1])));
2222
assert_eq!(a.lanes_gt(f32x4::splat(5.0)*b), Mask::from_int(i32x4::from_array([-1, 0, 0, -1])));
23+
24+
assert_eq!(a.horizontal_sum(), 40.0);
25+
assert_eq!(b.horizontal_sum(), 2.0);
26+
assert_eq!(a.horizontal_product(), 100.0*100.0);
27+
assert_eq!(b.horizontal_product(), -24.0);
2328
}
2429

2530
fn simd_ops_f64() {
@@ -41,6 +46,11 @@ fn simd_ops_f64() {
4146
assert_eq!(a.lanes_lt(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([0, 0, -1, 0])));
4247
assert_eq!(a.lanes_ge(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([-1, -1, 0, -1])));
4348
assert_eq!(a.lanes_gt(f64x4::splat(5.0)*b), Mask::from_int(i64x4::from_array([-1, 0, 0, -1])));
49+
50+
assert_eq!(a.horizontal_sum(), 40.0);
51+
assert_eq!(b.horizontal_sum(), 2.0);
52+
assert_eq!(a.horizontal_product(), 100.0*100.0);
53+
assert_eq!(b.horizontal_product(), -24.0);
4454
}
4555

4656
fn simd_ops_i32() {
@@ -78,7 +88,7 @@ fn simd_ops_i32() {
7888
assert_eq!(a.horizontal_sum(), 40);
7989
assert_eq!(b.horizontal_sum(), 2);
8090
assert_eq!(a.horizontal_product(), 100*100);
81-
assert_eq!(b.horizontal_product(), 6*-4);
91+
assert_eq!(b.horizontal_product(), -24);
8292
}
8393

8494
fn simd_intrinsics() {

0 commit comments

Comments
 (0)