From 0c43aa610d4d337e316d4b9f2d10440c8cf246ca Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 15:58:02 +0530 Subject: [PATCH 1/7] try to use simd eq --- crates/core_simd/src/vector.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 7c5ec2bc314..6aa7b815142 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -334,8 +334,9 @@ where { #[inline] fn eq(&self, other: &Self) -> bool { - // TODO use SIMD equality - self.to_array() == other.to_array() + unsafe { + instrinsics::simd_eq(*self, *other) == [true; LANES] + } } } From ab7a4d5152082d891ea4d33a95bcb240c920b3cc Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:01:03 +0530 Subject: [PATCH 2/7] fix typo --- crates/core_simd/src/vector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 6aa7b815142..9322b98bcb1 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -335,7 +335,7 @@ where #[inline] fn eq(&self, other: &Self) -> bool { unsafe { - instrinsics::simd_eq(*self, *other) == [true; LANES] + intrinsics::simd_eq(*self, *other) == [true; LANES] } } } From 8b9c9e2a0c058c7c9606860d2cc7ec0a75c5c29c Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:06:04 +0530 Subject: [PATCH 3/7] try to fix error --- crates/core_simd/src/vector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 9322b98bcb1..e844dcee01b 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -335,7 +335,7 @@ where #[inline] fn eq(&self, other: &Self) -> bool { unsafe { - intrinsics::simd_eq(*self, *other) == [true; LANES] + intrinsics::simd_eq::(*self, *other) == [true; LANES] } } } From 2a404a068810a8c08cd8ea7e8f81441d22c91dd1 Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:56:46 +0530 Subject: [PATCH 4/7] try to fix error --- crates/core_simd/src/vector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index e844dcee01b..83718f287d7 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -335,7 +335,7 @@ where #[inline] fn eq(&self, other: &Self) -> bool { unsafe { - intrinsics::simd_eq::(*self, *other) == [true; LANES] + intrinsics::simd_reduce_all(intrinsics::simd_eq::(*self, *other)) } } } From 2599a91a8837cea83e7a13af35bad0147b5d46b1 Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 18:02:19 +0530 Subject: [PATCH 5/7] try to fix error --- crates/core_simd/src/vector.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 83718f287d7..1ffada5fabf 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -330,12 +330,12 @@ where impl PartialEq for Simd where LaneCount: SupportedLaneCount, - T: SimdElement + PartialEq, + T: SimdElement, { #[inline] fn eq(&self, other: &Self) -> bool { unsafe { - intrinsics::simd_reduce_all(intrinsics::simd_eq::(*self, *other)) + intrinsics::simd_reduce_all(intrinsics::simd_eq::>(*self, *other)) } } } From 838d08fbb47c2f96dac3d59eec1a44fff32b9378 Mon Sep 17 00:00:00 2001 From: Pro465 Date: Mon, 6 Dec 2021 19:07:00 +0530 Subject: [PATCH 6/7] run `cargo fmt` --- crates/core_simd/src/vector.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 1ffada5fabf..587fefae023 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -334,9 +334,9 @@ where { #[inline] fn eq(&self, other: &Self) -> bool { - unsafe { - intrinsics::simd_reduce_all(intrinsics::simd_eq::>(*self, *other)) - } + unsafe { + intrinsics::simd_reduce_all(intrinsics::simd_eq::>(*self, *other)) + } } } From 2abf70cb7bc624705ba73052bb575ce4b8cbc638 Mon Sep 17 00:00:00 2001 From: Proloy Mishra <67726964+pro465@users.noreply.github.com> Date: Mon, 6 Dec 2021 19:32:34 +0530 Subject: [PATCH 7/7] correct wording in comments --- crates/core_simd/src/vector.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 587fefae023..7761df59623 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -347,7 +347,7 @@ where { #[inline] fn partial_cmp(&self, other: &Self) -> Option { - // TODO use SIMD equality + // TODO: use SIMD comparsion self.to_array().partial_cmp(other.as_ref()) } } @@ -366,7 +366,7 @@ where { #[inline] fn cmp(&self, other: &Self) -> core::cmp::Ordering { - // TODO use SIMD equality + // TODO: use SIMD comparsion self.to_array().cmp(other.as_ref()) } }