| 1 |
use super::*; |
| 2 |
|
| 3 |
#[test] |
| 4 |
fn test_addsub_m128d() { |
| 5 |
let a = m128d::from_array([10.0, 50.0]); |
| 6 |
let b = m128d::from_array([100.0, 500.0]); |
| 7 |
let c = addsub_m128d(a, b).to_array(); |
| 8 |
assert_eq!(c, [-90.0, 550.0]); |
| 9 |
} |
| 10 |
|
| 11 |
#[test] |
| 12 |
fn test_addsub_m128() { |
| 13 |
let a = m128::from_array([10.0, 20.0, 30.0, 40.0]); |
| 14 |
let b = m128::from_array([100.0, 200.0, 300.0, 400.0]); |
| 15 |
let c = addsub_m128(a, b).to_array(); |
| 16 |
assert_eq!(c, [-90.0, 220.0, -270.0, 440.0]); |
| 17 |
} |
| 18 |
|
| 19 |
#[test] |
| 20 |
fn test_add_horizontal_m128d() { |
| 21 |
let a = m128d::from_array([10.0, 50.0]); |
| 22 |
let b = m128d::from_array([100.0, 500.0]); |
| 23 |
let c = add_horizontal_m128d(a, b).to_array(); |
| 24 |
assert_eq!(c, [60.0, 600.0]); |
| 25 |
} |
| 26 |
|
| 27 |
#[test] |
| 28 |
fn test_add_horizontal_m128() { |
| 29 |
let a = m128::from_array([10.0, 20.0, 30.0, 40.0]); |
| 30 |
let b = m128::from_array([100.0, 200.0, 300.0, 400.0]); |
| 31 |
let c = add_horizontal_m128(a, b).to_array(); |
| 32 |
assert_eq!(c, [30.0, 70.0, 300.0, 700.0]); |
| 33 |
} |
| 34 |
|
| 35 |
#[test] |
| 36 |
fn test_sub_horizontal_m128d() { |
| 37 |
let a = m128d::from_array([10.0, 50.0]); |
| 38 |
let b = m128d::from_array([100.0, 500.0]); |
| 39 |
let c = sub_horizontal_m128d(a, b).to_array(); |
| 40 |
assert_eq!(c, [-40.0, -400.0]); |
| 41 |
} |
| 42 |
|
| 43 |
#[test] |
| 44 |
fn test_sub_horizontal_m128() { |
| 45 |
let a = m128::from_array([10.0, 20.0, 30.0, 45.0]); |
| 46 |
let b = m128::from_array([100.0, 200.0, 300.0, 450.0]); |
| 47 |
let c = sub_horizontal_m128(a, b).to_array(); |
| 48 |
assert_eq!(c, [-10.0, -15.0, -100.0, -150.0]); |
| 49 |
} |
| 50 |
|
| 51 |
#[test] |
| 52 |
fn test_duplicate_low_lane_m128d_s() { |
| 53 |
let a = m128d::from_array([1.0, 2.0]); |
| 54 |
let b = duplicate_low_lane_m128d_s(a); |
| 55 |
assert_eq!(b.to_array(), [1.0, 1.0]); |
| 56 |
} |
| 57 |
|
| 58 |
#[test] |
| 59 |
fn test_duplicate_odd_lanes_m128() { |
| 60 |
let a = m128::from_array([0.0, 1.0, 2.0, 3.0]); |
| 61 |
let b = duplicate_odd_lanes_m128(a); |
| 62 |
assert_eq!(b.to_array(), [1.0, 1.0, 3.0, 3.0]); |
| 63 |
} |
| 64 |
|
| 65 |
#[test] |
| 66 |
fn test_duplicate_even_lanes_m128() { |
| 67 |
let a = m128::from_array([0.0, 1.0, 2.0, 3.0]); |
| 68 |
let b = duplicate_even_lanes_m128(a); |
| 69 |
assert_eq!(b.to_array(), [0.0, 0.0, 2.0, 2.0]); |
| 70 |
} |