]>
git.proxmox.com Git - rustc.git/blob - vendor/packed_simd_2/src/codegen/reductions/mask/x86/sse2.rs
1 //! Mask reductions implementation for `x86` and `x86_64` targets with `SSE2`.
4 /// `x86`/`x86_64` 128-bit m64x2 `SSE2` implementation
5 macro_rules
! x86_m64x2_sse2_impl
{
9 #[target_feature(enable = "sse")]
10 unsafe fn all(self) -> bool
{
11 #[cfg(target_arch = "x86")]
12 use crate::arch
::x86
::_mm_movemask_pd
;
13 #[cfg(target_arch = "x86_64")]
14 use crate::arch
::x86_64
::_mm_movemask_pd
;
15 // _mm_movemask_pd(a) creates a 2bit mask containing the
16 // most significant bit of each lane of `a`. If all
17 // bits are set, then all 2 lanes of the mask are
19 _mm_movemask_pd(crate::mem
::transmute(self))
25 #[target_feature(enable = "sse")]
26 unsafe fn any(self) -> bool
{
27 #[cfg(target_arch = "x86")]
28 use crate::arch
::x86
::_mm_movemask_pd
;
29 #[cfg(target_arch = "x86_64")]
30 use crate::arch
::x86_64
::_mm_movemask_pd
;
32 _mm_movemask_pd(crate::mem
::transmute(self)) != 0
38 /// `x86`/`x86_64` 128-bit m8x16 `SSE2` implementation
39 macro_rules
! x86_m8x16_sse2_impl
{
43 #[target_feature(enable = "sse2")]
44 unsafe fn all(self) -> bool
{
45 #[cfg(target_arch = "x86")]
46 use crate::arch
::x86
::_mm_movemask_epi8
;
47 #[cfg(target_arch = "x86_64")]
48 use crate::arch
::x86_64
::_mm_movemask_epi8
;
49 // _mm_movemask_epi8(a) creates a 16bit mask containing the
50 // most significant bit of each byte of `a`. If all
51 // bits are set, then all 16 lanes of the mask are
53 _mm_movemask_epi8(crate::mem
::transmute(self))
54 == i32::from(u16::max_value())
59 #[target_feature(enable = "sse2")]
60 unsafe fn any(self) -> bool
{
61 #[cfg(target_arch = "x86")]
62 use crate::arch
::x86
::_mm_movemask_epi8
;
63 #[cfg(target_arch = "x86_64")]
64 use crate::arch
::x86_64
::_mm_movemask_epi8
;
66 _mm_movemask_epi8(crate::mem
::transmute(self)) != 0