From b598970430d41c1c13aebed94922dfd4fe5e7173 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Sat, 29 Jun 2024 21:02:29 +0700 Subject: [PATCH 1/6] Adds conversion functions from integers to floats --- src/f32x4_.rs | 20 ++++++++++++++++++++ src/f32x8_.rs | 20 ++++++++++++++++++++ src/f64x2_.rs | 15 +++++++++++++++ src/f64x4_.rs | 16 ++++++++++++++++ src/i64x2_.rs | 2 +- 5 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/f32x4_.rs b/src/f32x4_.rs index 8b5cd62d..4ec6546d 100644 --- a/src/f32x4_.rs +++ b/src/f32x4_.rs @@ -1578,4 +1578,24 @@ impl f32x4 { pub fn as_array_mut(&mut self) -> &mut [f32; 4] { cast_mut(self) } + + #[inline] + pub fn from_i32x4(v: i32x4) -> Self { + pick! { + if #[cfg(target_feature="sse2")] { + Self { sse: convert_to_m128_from_i32_m128i(v.sse) } + } else if #[cfg(target_feature="simd128")] { + Self { simd: core::arch::wasm::f32x4_convert_i32x4(v.simd) } + } else if #[cfg(all(target_feature="neon",target_arch="aarch64"))] { + Self { neon: unsafe { core::arch::aarch64::vcvtq_f32_s32(v.neon) }} + } else { + Self { arr: [ + v.as_array_ref()[0] as f32, + v.as_array_ref()[1] as f32, + v.as_array_ref()[2] as f32, + v.as_array_ref()[3] as f32, + ] } + } + } + } } diff --git a/src/f32x8_.rs b/src/f32x8_.rs index 5df2ef16..3d88762f 100644 --- a/src/f32x8_.rs +++ b/src/f32x8_.rs @@ -1418,6 +1418,26 @@ impl f32x8 { pub fn as_array_mut(&mut self) -> &mut [f32; 8] { cast_mut(self) } + + #[inline] + pub fn from_i32x8(v: i32x8) -> Self { + pick! { + if #[cfg(target_feature="avx2")] { + Self { avx: safe_arch::convert_to_m256_from_i32_m256i(v.avx2) } + } else { + Self::new([ + v.as_array_ref()[0] as f32, + v.as_array_ref()[1] as f32, + v.as_array_ref()[2] as f32, + v.as_array_ref()[3] as f32, + v.as_array_ref()[4] as f32, + v.as_array_ref()[5] as f32, + v.as_array_ref()[6] as f32, + v.as_array_ref()[7] as f32, + ]) + } + } + } } impl Not for f32x8 { diff --git a/src/f64x2_.rs b/src/f64x2_.rs index dc7b6cf9..7f41cc4f 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -1608,6 +1608,21 @@ impl f64x2 { pub fn as_array_mut(&mut self) -> &mut [f64; 2] { cast_mut(self) } + + /// Converts the lower two i32 lanes to two f64 lanes + #[inline] + pub fn from_i32x4(v: i32x4) -> Self { + pick! { + if #[cfg(target_feature="sse2")] { + Self { sse: convert_to_m128d_from_lower2_i32_m128i(v.sse) } + } else { + Self { arr: [ + v.as_array_ref()[0] as f64, + v.as_array_ref()[1] as f64, + ]} + } + } + } } impl Not for f64x2 { diff --git a/src/f64x4_.rs b/src/f64x4_.rs index 1d9ddefd..a3aa7364 100644 --- a/src/f64x4_.rs +++ b/src/f64x4_.rs @@ -1473,6 +1473,22 @@ impl f64x4 { pub fn as_array_mut(&mut self) -> &mut [f64; 4] { cast_mut(self) } + + #[inline] + pub fn from_i32x4(v: i32x4) -> Self { + pick! { + if #[cfg(target_feature="avx")] { + Self { avx: convert_to_m256d_from_i32_m128i(v.sse) } + } else { + Self::new([ + v.as_array_ref()[0] as f64, + v.as_array_ref()[1] as f64, + v.as_array_ref()[2] as f64, + v.as_array_ref()[3] as f64, + ]) + } + } + } } impl Not for f64x4 { diff --git a/src/i64x2_.rs b/src/i64x2_.rs index 3419f120..69b2d7e3 100644 --- a/src/i64x2_.rs +++ b/src/i64x2_.rs @@ -4,7 +4,7 @@ pick! { if #[cfg(target_feature="sse2")] { #[derive(Default, Clone, Copy, PartialEq, Eq)] #[repr(C, align(16))] - pub struct i64x2 { sse: m128i } + pub struct i64x2 { pub(crate) sse: m128i } } else if #[cfg(target_feature="simd128")] { use core::arch::wasm32::*; From d72bd0811a8a7131482b7285e18df52363f31986 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Sat, 29 Jun 2024 21:17:14 +0700 Subject: [PATCH 2/6] Adds tests for f32x4::from_i32x4, f32x8::from_i32x8, f64x2::from_i32x4, f64x4::from_i32x4 --- tests/all_tests/t_f32x4.rs | 7 +++++++ tests/all_tests/t_f32x8.rs | 7 +++++++ tests/all_tests/t_f64x2.rs | 7 +++++++ tests/all_tests/t_f64x4.rs | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/tests/all_tests/t_f32x4.rs b/tests/all_tests/t_f32x4.rs index 8a45200a..e2d24d73 100644 --- a/tests/all_tests/t_f32x4.rs +++ b/tests/all_tests/t_f32x4.rs @@ -816,3 +816,10 @@ fn impl_f32x4_sum() { let duration = now.elapsed().as_micros(); println!("Time take {} {}us", sum2, duration); } + +#[test] +fn impl_f32x4_from_i32x4() { + let i = i32x4::from([1, 2, 3, 4]); + let f = f32x4::from([1.0, 2.0, 3.0, 4.0]); + assert_eq!(f32x4::from_i32x4(i), f) +} diff --git a/tests/all_tests/t_f32x8.rs b/tests/all_tests/t_f32x8.rs index d2755fc5..6ae6e900 100644 --- a/tests/all_tests/t_f32x8.rs +++ b/tests/all_tests/t_f32x8.rs @@ -930,3 +930,10 @@ fn impl_transpose_for_f32x8() { assert_eq!(result, expected); } + +#[test] +fn impl_f32x8_from_i32x8() { + let i = i32x8::from([1, 2, 3, 4, 5, 6, 7, 8]); + let f = f32x8::from([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]); + assert_eq!(f32x8::from_i32x8(i), f) +} diff --git a/tests/all_tests/t_f64x2.rs b/tests/all_tests/t_f64x2.rs index 3e47df46..f9c899aa 100644 --- a/tests/all_tests/t_f64x2.rs +++ b/tests/all_tests/t_f64x2.rs @@ -815,3 +815,10 @@ fn impl_f64x2_sum() { let duration = now.elapsed().as_micros(); println!("Time take {} {}us", sum2, duration); } + +#[test] +fn impl_f64x2_from_i32x4() { + let i = i32x4::from([1, 2, 3, 4]); + let f = f64x2::from([1.0, 2.0]); + assert_eq!(f64x2::from_i32x4(i), f) +} diff --git a/tests/all_tests/t_f64x4.rs b/tests/all_tests/t_f64x4.rs index 5addc736..06a3bdb9 100644 --- a/tests/all_tests/t_f64x4.rs +++ b/tests/all_tests/t_f64x4.rs @@ -709,3 +709,10 @@ fn impl_f64x4_sum() { let duration = now.elapsed().as_micros(); println!("Time take {} {}us", sum2, duration); } + +#[test] +fn impl_f64x4_from_i32x4() { + let i = i32x4::from([1, 2, 3, 4]); + let f = f64x4::from([1.0, 2.0, 3.0, 4.0]); + assert_eq!(f64x4::from_i32x4(i), f) +} From 3bd380166037d016e6412de63ce73ca9d08f6a14 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Mon, 1 Jul 2024 17:09:08 +0700 Subject: [PATCH 3/6] Fixes implementation for neon, moves convertion functions to From trait --- src/f32x4_.rs | 16 +++++++++------- src/f32x8_.rs | 6 ++++-- src/f64x2_.rs | 18 ++++++++++++------ src/f64x4_.rs | 8 +++++--- src/i64x2_.rs | 4 ++-- tests/all_tests/t_f32x4.rs | 2 +- tests/all_tests/t_f32x8.rs | 2 +- tests/all_tests/t_f64x2.rs | 2 +- tests/all_tests/t_f64x4.rs | 2 +- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/f32x4_.rs b/src/f32x4_.rs index 4ec6546d..4dd56ae6 100644 --- a/src/f32x4_.rs +++ b/src/f32x4_.rs @@ -4,13 +4,13 @@ pick! { if #[cfg(target_feature="sse")] { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(16))] - pub struct f32x4 { sse: m128 } + pub struct f32x4 { pub(crate) sse: m128 } } else if #[cfg(target_feature="simd128")] { use core::arch::wasm32::*; #[derive(Clone, Copy)] #[repr(transparent)] - pub struct f32x4 { simd: v128 } + pub struct f32x4 { pub(crate) simd: v128 } impl Default for f32x4 { fn default() -> Self { @@ -27,7 +27,7 @@ pick! { use core::arch::aarch64::*; #[repr(C)] #[derive(Copy, Clone)] - pub struct f32x4 { neon : float32x4_t } + pub struct f32x4 { pub(crate) neon : float32x4_t } impl Default for f32x4 { #[inline] @@ -48,7 +48,7 @@ pick! { } else { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(16))] - pub struct f32x4 { arr: [f32;4] } + pub struct f32x4 { pub(crate) arr: [f32;4] } } } @@ -1578,16 +1578,18 @@ impl f32x4 { pub fn as_array_mut(&mut self) -> &mut [f32; 4] { cast_mut(self) } +} +impl From for f32x4 { #[inline] - pub fn from_i32x4(v: i32x4) -> Self { + fn from(v: i32x4) -> Self { pick! { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128_from_i32_m128i(v.sse) } } else if #[cfg(target_feature="simd128")] { - Self { simd: core::arch::wasm::f32x4_convert_i32x4(v.simd) } + Self { simd: f32x4_convert_i32x4(v.simd) } } else if #[cfg(all(target_feature="neon",target_arch="aarch64"))] { - Self { neon: unsafe { core::arch::aarch64::vcvtq_f32_s32(v.neon) }} + Self { neon: unsafe { vcvtq_f32_s32(v.neon) }} } else { Self { arr: [ v.as_array_ref()[0] as f32, diff --git a/src/f32x8_.rs b/src/f32x8_.rs index 3d88762f..4aaecd91 100644 --- a/src/f32x8_.rs +++ b/src/f32x8_.rs @@ -1418,12 +1418,14 @@ impl f32x8 { pub fn as_array_mut(&mut self) -> &mut [f32; 8] { cast_mut(self) } +} +impl From for f32x8 { #[inline] - pub fn from_i32x8(v: i32x8) -> Self { + fn from(v: i32x8) -> Self { pick! { if #[cfg(target_feature="avx2")] { - Self { avx: safe_arch::convert_to_m256_from_i32_m256i(v.avx2) } + Self { avx: convert_to_m256_from_i32_m256i(v.avx2) } } else { Self::new([ v.as_array_ref()[0] as f32, diff --git a/src/f64x2_.rs b/src/f64x2_.rs index 7f41cc4f..5f9cdc2f 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -4,13 +4,13 @@ pick! { if #[cfg(target_feature="sse2")] { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(16))] - pub struct f64x2 { sse: m128d } + pub struct f64x2 { pub(crate) sse: m128d } } else if #[cfg(target_feature="simd128")] { use core::arch::wasm32::*; #[derive(Clone, Copy)] #[repr(transparent)] - pub struct f64x2 { simd: v128 } + pub struct f64x2 { pub(crate) simd: v128 } impl Default for f64x2 { fn default() -> Self { @@ -27,7 +27,7 @@ pick! { use core::arch::aarch64::*; #[repr(C)] #[derive(Copy, Clone)] - pub struct f64x2 { neon : float64x2_t } + pub struct f64x2 { pub(crate) neon: float64x2_t } impl Default for f64x2 { #[inline] @@ -51,7 +51,7 @@ pick! { } else { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(16))] - pub struct f64x2 { arr: [f64;2] } + pub struct f64x2 { pub(crate) arr: [f64;2] } } } @@ -1608,13 +1608,19 @@ impl f64x2 { pub fn as_array_mut(&mut self) -> &mut [f64; 2] { cast_mut(self) } +} - /// Converts the lower two i32 lanes to two f64 lanes +impl From for f64x2 { + /// Converts the lower two i32 lanes to two f64 lanes (and dropping ther higher two i32 lanes) #[inline] - pub fn from_i32x4(v: i32x4) -> Self { + fn from(v: i32x4) -> Self { pick! { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128d_from_lower2_i32_m128i(v.sse) } + } else if #[cfg(target_feature="simd128")] { + Self { simd128: f64x2_convert_low_i32x4(v.simd128)} + } else if #[cfg(all(target_feature="neon",target_arch="aarch64"))] { + Self { neon: unsafe { vcvtq_f64_s64(vmovl_s32(vget_low_s32(v.neon))) }} } else { Self { arr: [ v.as_array_ref()[0] as f64, diff --git a/src/f64x4_.rs b/src/f64x4_.rs index a3aa7364..f44e35f4 100644 --- a/src/f64x4_.rs +++ b/src/f64x4_.rs @@ -4,11 +4,11 @@ pick! { if #[cfg(target_feature="avx")] { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(32))] - pub struct f64x4 { avx: m256d } + pub struct f64x4 { pub(crate) avx: m256d } } else { #[derive(Default, Clone, Copy, PartialEq)] #[repr(C, align(32))] - pub struct f64x4 { a : f64x2, b : f64x2 } + pub struct f64x4 { pub(crate) a: f64x2, pub(crate) b: f64x2 } } } @@ -1473,9 +1473,11 @@ impl f64x4 { pub fn as_array_mut(&mut self) -> &mut [f64; 4] { cast_mut(self) } +} +impl From for f64x4 { #[inline] - pub fn from_i32x4(v: i32x4) -> Self { + fn from(v: i32x4) -> Self { pick! { if #[cfg(target_feature="avx")] { Self { avx: convert_to_m256d_from_i32_m128i(v.sse) } diff --git a/src/i64x2_.rs b/src/i64x2_.rs index 69b2d7e3..c3704a4d 100644 --- a/src/i64x2_.rs +++ b/src/i64x2_.rs @@ -10,7 +10,7 @@ pick! { #[derive(Clone, Copy)] #[repr(transparent)] - pub struct i64x2 { simd: v128 } + pub struct i64x2 { pub(crate) simd: v128 } impl Default for i64x2 { fn default() -> Self { @@ -29,7 +29,7 @@ pick! { use core::arch::aarch64::*; #[repr(C)] #[derive(Copy, Clone)] - pub struct i64x2 { neon : int64x2_t } + pub struct i64x2 { pub(crate) neon : int64x2_t } impl Default for i64x2 { #[inline] diff --git a/tests/all_tests/t_f32x4.rs b/tests/all_tests/t_f32x4.rs index e2d24d73..3de7139a 100644 --- a/tests/all_tests/t_f32x4.rs +++ b/tests/all_tests/t_f32x4.rs @@ -821,5 +821,5 @@ fn impl_f32x4_sum() { fn impl_f32x4_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f32x4::from([1.0, 2.0, 3.0, 4.0]); - assert_eq!(f32x4::from_i32x4(i), f) + assert_eq!(f32x4::from(i), f) } diff --git a/tests/all_tests/t_f32x8.rs b/tests/all_tests/t_f32x8.rs index 6ae6e900..d429268c 100644 --- a/tests/all_tests/t_f32x8.rs +++ b/tests/all_tests/t_f32x8.rs @@ -935,5 +935,5 @@ fn impl_transpose_for_f32x8() { fn impl_f32x8_from_i32x8() { let i = i32x8::from([1, 2, 3, 4, 5, 6, 7, 8]); let f = f32x8::from([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]); - assert_eq!(f32x8::from_i32x8(i), f) + assert_eq!(f32x8::from(i), f) } diff --git a/tests/all_tests/t_f64x2.rs b/tests/all_tests/t_f64x2.rs index f9c899aa..4bdba0df 100644 --- a/tests/all_tests/t_f64x2.rs +++ b/tests/all_tests/t_f64x2.rs @@ -820,5 +820,5 @@ fn impl_f64x2_sum() { fn impl_f64x2_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f64x2::from([1.0, 2.0]); - assert_eq!(f64x2::from_i32x4(i), f) + assert_eq!(f64x2::from(i), f) } diff --git a/tests/all_tests/t_f64x4.rs b/tests/all_tests/t_f64x4.rs index 06a3bdb9..107d92f3 100644 --- a/tests/all_tests/t_f64x4.rs +++ b/tests/all_tests/t_f64x4.rs @@ -714,5 +714,5 @@ fn impl_f64x4_sum() { fn impl_f64x4_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f64x4::from([1.0, 2.0, 3.0, 4.0]); - assert_eq!(f64x4::from_i32x4(i), f) + assert_eq!(f64x4::from(i), f) } From 33a786a66a423a0b03e5a41ec2f0feacb018ef47 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Sun, 7 Jul 2024 22:43:09 +0700 Subject: [PATCH 4/6] Removes lossy From impls --- src/f32x4_.rs | 4 +--- src/f32x8_.rs | 4 +--- src/f64x2_.rs | 12 +++++++++--- src/f64x4_.rs | 11 ++++++++--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/f32x4_.rs b/src/f32x4_.rs index 4dd56ae6..34aea300 100644 --- a/src/f32x4_.rs +++ b/src/f32x4_.rs @@ -1578,11 +1578,9 @@ impl f32x4 { pub fn as_array_mut(&mut self) -> &mut [f32; 4] { cast_mut(self) } -} -impl From for f32x4 { #[inline] - fn from(v: i32x4) -> Self { + pub fn from_i32x4(v: i32x4) -> Self { pick! { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128_from_i32_m128i(v.sse) } diff --git a/src/f32x8_.rs b/src/f32x8_.rs index 4aaecd91..8c5dd976 100644 --- a/src/f32x8_.rs +++ b/src/f32x8_.rs @@ -1418,11 +1418,9 @@ impl f32x8 { pub fn as_array_mut(&mut self) -> &mut [f32; 8] { cast_mut(self) } -} -impl From for f32x8 { #[inline] - fn from(v: i32x8) -> Self { + pub fn from_i32x8(v: i32x8) -> Self { pick! { if #[cfg(target_feature="avx2")] { Self { avx: convert_to_m256_from_i32_m256i(v.avx2) } diff --git a/src/f64x2_.rs b/src/f64x2_.rs index 5f9cdc2f..a3a85e30 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -1608,12 +1608,10 @@ impl f64x2 { pub fn as_array_mut(&mut self) -> &mut [f64; 2] { cast_mut(self) } -} -impl From for f64x2 { /// Converts the lower two i32 lanes to two f64 lanes (and dropping ther higher two i32 lanes) #[inline] - fn from(v: i32x4) -> Self { + pub fn from_i32x4(v: i32x4) -> Self { pick! { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128d_from_lower2_i32_m128i(v.sse) } @@ -1631,6 +1629,14 @@ impl From for f64x2 { } } +impl From for f64x2 { + /// Converts the lower two i32 lanes to two f64 lanes (and dropping ther higher two i32 lanes) + #[inline] + fn from(v: i32x4) -> Self { + Self::from_i32x4(v) + } +} + impl Not for f64x2 { type Output = Self; #[inline] diff --git a/src/f64x4_.rs b/src/f64x4_.rs index f44e35f4..6010955c 100644 --- a/src/f64x4_.rs +++ b/src/f64x4_.rs @@ -1473,11 +1473,9 @@ impl f64x4 { pub fn as_array_mut(&mut self) -> &mut [f64; 4] { cast_mut(self) } -} -impl From for f64x4 { #[inline] - fn from(v: i32x4) -> Self { + pub fn from_i32x4(v: i32x4) -> Self { pick! { if #[cfg(target_feature="avx")] { Self { avx: convert_to_m256d_from_i32_m128i(v.sse) } @@ -1493,6 +1491,13 @@ impl From for f64x4 { } } +impl From for f64x4 { + #[inline] + fn from(v: i32x4) -> Self { + Self::from_i32x4(v) + } +} + impl Not for f64x4 { type Output = Self; #[inline] From c88b53b89827099c2d6c26b4db88b65f3f112344 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Sun, 7 Jul 2024 22:52:16 +0700 Subject: [PATCH 5/6] Fixes tests --- src/f64x2_.rs | 4 ++-- tests/all_tests/t_f32x4.rs | 2 +- tests/all_tests/t_f32x8.rs | 2 +- tests/all_tests/t_f64x2.rs | 2 +- tests/all_tests/t_f64x4.rs | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/f64x2_.rs b/src/f64x2_.rs index a3a85e30..6af01564 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -1611,7 +1611,7 @@ impl f64x2 { /// Converts the lower two i32 lanes to two f64 lanes (and dropping ther higher two i32 lanes) #[inline] - pub fn from_i32x4(v: i32x4) -> Self { + pub fn from_i32x4_lower2(v: i32x4) -> Self { pick! { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128d_from_lower2_i32_m128i(v.sse) } @@ -1633,7 +1633,7 @@ impl From for f64x2 { /// Converts the lower two i32 lanes to two f64 lanes (and dropping ther higher two i32 lanes) #[inline] fn from(v: i32x4) -> Self { - Self::from_i32x4(v) + Self::from_i32x4_lower2(v) } } diff --git a/tests/all_tests/t_f32x4.rs b/tests/all_tests/t_f32x4.rs index 3de7139a..e2d24d73 100644 --- a/tests/all_tests/t_f32x4.rs +++ b/tests/all_tests/t_f32x4.rs @@ -821,5 +821,5 @@ fn impl_f32x4_sum() { fn impl_f32x4_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f32x4::from([1.0, 2.0, 3.0, 4.0]); - assert_eq!(f32x4::from(i), f) + assert_eq!(f32x4::from_i32x4(i), f) } diff --git a/tests/all_tests/t_f32x8.rs b/tests/all_tests/t_f32x8.rs index d429268c..6ae6e900 100644 --- a/tests/all_tests/t_f32x8.rs +++ b/tests/all_tests/t_f32x8.rs @@ -935,5 +935,5 @@ fn impl_transpose_for_f32x8() { fn impl_f32x8_from_i32x8() { let i = i32x8::from([1, 2, 3, 4, 5, 6, 7, 8]); let f = f32x8::from([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]); - assert_eq!(f32x8::from(i), f) + assert_eq!(f32x8::from_i32x8(i), f) } diff --git a/tests/all_tests/t_f64x2.rs b/tests/all_tests/t_f64x2.rs index 4bdba0df..33828671 100644 --- a/tests/all_tests/t_f64x2.rs +++ b/tests/all_tests/t_f64x2.rs @@ -820,5 +820,5 @@ fn impl_f64x2_sum() { fn impl_f64x2_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f64x2::from([1.0, 2.0]); - assert_eq!(f64x2::from(i), f) + assert_eq!(f64x2::from_i32x4_lower2(i), f) } diff --git a/tests/all_tests/t_f64x4.rs b/tests/all_tests/t_f64x4.rs index 107d92f3..5bcf6b12 100644 --- a/tests/all_tests/t_f64x4.rs +++ b/tests/all_tests/t_f64x4.rs @@ -714,5 +714,6 @@ fn impl_f64x4_sum() { fn impl_f64x4_from_i32x4() { let i = i32x4::from([1, 2, 3, 4]); let f = f64x4::from([1.0, 2.0, 3.0, 4.0]); - assert_eq!(f64x4::from(i), f) + assert_eq!(f64x4::from(i), f); + assert_eq!(f64x4::from_i32x4(i), f); } From 9fb08ede14445dd0e5a519df5622ee823a4b49fd Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Mon, 8 Jul 2024 22:04:33 +0700 Subject: [PATCH 6/6] Fixes wasm --- src/f64x2_.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f64x2_.rs b/src/f64x2_.rs index 6af01564..704f20c5 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -1616,7 +1616,7 @@ impl f64x2 { if #[cfg(target_feature="sse2")] { Self { sse: convert_to_m128d_from_lower2_i32_m128i(v.sse) } } else if #[cfg(target_feature="simd128")] { - Self { simd128: f64x2_convert_low_i32x4(v.simd128)} + Self { simd: f64x2_convert_low_i32x4(v.simd)} } else if #[cfg(all(target_feature="neon",target_arch="aarch64"))] { Self { neon: unsafe { vcvtq_f64_s64(vmovl_s32(vget_low_s32(v.neon))) }} } else {