]>
git.proxmox.com Git - rustc.git/blob - vendor/packed_simd/src/codegen/reductions/mask/x86/sse.rs
1 //! Mask reductions implementation for `x86` and `x86_64` targets with `SSE`.
4 /// `x86`/`x86_64` 128-bit `m32x4` `SSE` implementation
5 macro_rules
! x86_m32x4_sse_impl
{
9 #[target_feature(enable = "sse")]
10 unsafe fn all(self) -> bool
{
11 #[cfg(target_arch = "x86")]
12 use crate::arch
::x86
::_mm_movemask_ps
;
13 #[cfg(target_arch = "x86_64")]
14 use crate::arch
::x86_64
::_mm_movemask_ps
;
15 // _mm_movemask_ps(a) creates a 4bit mask containing the
16 // most significant bit of each lane of `a`. If all
17 // bits are set, then all 4 lanes of the mask are
19 _mm_movemask_ps(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_ps
;
29 #[cfg(target_arch = "x86_64")]
30 use crate::arch
::x86_64
::_mm_movemask_ps
;
32 _mm_movemask_ps(crate::mem
::transmute(self)) != 0
38 macro_rules
! x86_m8x8_sse_impl
{
42 #[target_feature(enable = "sse")]
43 unsafe fn all(self) -> bool
{
44 #[cfg(target_arch = "x86")]
45 use crate::arch
::x86
::_mm_movemask_pi8
;
46 #[cfg(target_arch = "x86_64")]
47 use crate::arch
::x86_64
::_mm_movemask_pi8
;
48 // _mm_movemask_pi8(a) creates an 8bit mask containing the most
49 // significant bit of each byte of `a`. If all bits are set,
50 // then all 8 lanes of the mask are true.
51 _mm_movemask_pi8(crate::mem
::transmute(self))
52 == u8::max_value() as i32
57 #[target_feature(enable = "sse")]
58 unsafe fn any(self) -> bool
{
59 #[cfg(target_arch = "x86")]
60 use crate::arch
::x86
::_mm_movemask_pi8
;
61 #[cfg(target_arch = "x86_64")]
62 use crate::arch
::x86_64
::_mm_movemask_pi8
;
64 _mm_movemask_pi8(crate::mem
::transmute(self)) != 0