1 | /* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt> |
2 | |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef LIBSIMDPP_SIMDPP_CORE_CMP_LE_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_CMP_LE_H |
10 | |
11 | #ifndef LIBSIMDPP_SIMD_H |
12 | #error "This file must be included through simd.h" |
13 | #endif |
14 | |
15 | #include <simdpp/types.h> |
16 | #include <simdpp/detail/insn/cmp_le.h> |
17 | #include <simdpp/core/detail/scalar_arg_impl.h> |
18 | |
19 | namespace simdpp { |
20 | namespace SIMDPP_ARCH_NAMESPACE { |
21 | |
22 | template<unsigned N, class E1, class E2> SIMDPP_INL |
23 | mask_int8<N,expr_empty> cmp_le(const int8<N,E1>& a, |
24 | const int8<N,E2>& b) |
25 | { |
26 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
27 | } |
28 | |
29 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int8, int8) |
30 | |
31 | template<unsigned N, class E1, class E2> SIMDPP_INL |
32 | mask_int8<N,expr_empty> cmp_le(const uint8<N,E1>& a, |
33 | const uint8<N,E2>& b) |
34 | { |
35 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
36 | } |
37 | |
38 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int8, uint8) |
39 | |
40 | template<unsigned N, class E1, class E2> SIMDPP_INL |
41 | mask_int16<N,expr_empty> cmp_le(const int16<N,E1>& a, |
42 | const int16<N,E2>& b) |
43 | { |
44 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
45 | } |
46 | |
47 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int16, int16) |
48 | |
49 | template<unsigned N, class E1, class E2> SIMDPP_INL |
50 | mask_int16<N,expr_empty> cmp_le(const uint16<N,E1>& a, |
51 | const uint16<N,E2>& b) |
52 | { |
53 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
54 | } |
55 | |
56 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int16, uint16) |
57 | |
58 | template<unsigned N, class E1, class E2> SIMDPP_INL |
59 | mask_int32<N,expr_empty> cmp_le(const int32<N,E1>& a, |
60 | const int32<N,E2>& b) |
61 | { |
62 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
63 | } |
64 | |
65 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int32, int32) |
66 | |
67 | template<unsigned N, class E1, class E2> SIMDPP_INL |
68 | mask_int32<N,expr_empty> cmp_le(const uint32<N,E1>& a, |
69 | const uint32<N,E2>& b) |
70 | { |
71 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
72 | } |
73 | |
74 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int32, uint32) |
75 | |
76 | template<unsigned N, class E1, class E2> SIMDPP_INL |
77 | mask_int64<N,expr_empty> cmp_le(const int64<N,E1>& a, |
78 | const int64<N,E2>& b) |
79 | { |
80 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
81 | } |
82 | |
83 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int64, int64) |
84 | |
85 | template<unsigned N, class E1, class E2> SIMDPP_INL |
86 | mask_int64<N,expr_empty> cmp_le(const uint64<N,E1>& a, |
87 | const uint64<N,E2>& b) |
88 | { |
89 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
90 | } |
91 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int64, uint64) |
92 | |
93 | /** Compares the values of two float32x4 vectors for less-than or equal |
94 | |
95 | @code |
96 | r0 = (a0 <= b0) ? 0xffffffff : 0x0 |
97 | ... |
98 | rN = (aN <= bN) ? 0xffffffff : 0x0 |
99 | @endcode |
100 | |
101 | @par 256-bit version: |
102 | @icost{SSE2-AVX, NEON, ALTIVEC, 2} |
103 | */ |
104 | template<unsigned N, class E1, class E2> SIMDPP_INL |
105 | mask_float32<N,expr_empty> cmp_le(const float32<N,E1>& a, |
106 | const float32<N,E2>& b) |
107 | { |
108 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
109 | } |
110 | |
111 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_float32, float32) |
112 | |
113 | /** Compares the values of two float64x2 vectors for less-than or equal |
114 | |
115 | @code |
116 | r0 = (a0 <= b0) ? 0xffffffffffffffff : 0x0 |
117 | ... |
118 | rN = (aN <= bN) ? 0xffffffffffffffff : 0x0 |
119 | @endcode |
120 | |
121 | @par 128-bit version: |
122 | @novec{NEON, ALTIVEC} |
123 | |
124 | @par 256-bit version: |
125 | @novec{NEON, ALTIVEC} |
126 | @icost{SSE2-SSE4.1, 2} |
127 | */ |
128 | template<unsigned N, class E1, class E2> SIMDPP_INL |
129 | mask_float64<N,expr_empty> cmp_le(const float64<N,E1>& a, |
130 | const float64<N,E2>& b) |
131 | { |
132 | return detail::insn::i_cmp_le(a.eval(), b.eval()); |
133 | } |
134 | |
135 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_float64, float64) |
136 | |
137 | } // namespace SIMDPP_ARCH_NAMESPACE |
138 | } // namespace simdpp |
139 | |
140 | #endif |
141 | |
142 | |