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_GE_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_CMP_GE_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_ge.h> |
17 | #include <simdpp/core/detail/scalar_arg_impl.h> |
18 | |
19 | namespace simdpp { |
20 | namespace SIMDPP_ARCH_NAMESPACE { |
21 | |
22 | /** Compares the values of two signed int16x8 vectors for greater-than |
23 | |
24 | @code |
25 | r0 = (a0 >= b0) ? ~0x0 : 0x0 |
26 | ... |
27 | rN = (aN >= bN) ? ~0x0 : 0x0 |
28 | @endcode |
29 | */ |
30 | template<unsigned N, class E1, class E2> SIMDPP_INL |
31 | mask_int8<N,expr_empty> cmp_ge(const int8<N,E1>& a, |
32 | const int8<N,E2>& b) |
33 | { |
34 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
35 | } |
36 | |
37 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, int8) |
38 | |
39 | template<unsigned N, class E1, class E2> SIMDPP_INL |
40 | mask_int8<N,expr_empty> cmp_ge(const uint8<N,E1>& a, |
41 | const uint8<N,E2>& b) |
42 | { |
43 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
44 | } |
45 | |
46 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, uint8) |
47 | |
48 | template<unsigned N, class E1, class E2> SIMDPP_INL |
49 | mask_int16<N,expr_empty> cmp_ge(const int16<N,E1>& a, |
50 | const int16<N,E2>& b) |
51 | { |
52 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
53 | } |
54 | |
55 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, int16) |
56 | |
57 | template<unsigned N, class E1, class E2> SIMDPP_INL |
58 | mask_int16<N,expr_empty> cmp_ge(const uint16<N,E1>& a, |
59 | const uint16<N,E2>& b) |
60 | { |
61 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
62 | } |
63 | |
64 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, uint16) |
65 | |
66 | template<unsigned N, class E1, class E2> SIMDPP_INL |
67 | mask_int32<N,expr_empty> cmp_ge(const int32<N,E1>& a, |
68 | const int32<N,E2>& b) |
69 | { |
70 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
71 | } |
72 | |
73 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, int32) |
74 | |
75 | template<unsigned N, class E1, class E2> SIMDPP_INL |
76 | mask_int32<N,expr_empty> cmp_ge(const uint32<N,E1>& a, |
77 | const uint32<N,E2>& b) |
78 | { |
79 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
80 | } |
81 | |
82 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, uint32) |
83 | |
84 | template<unsigned N, class E1, class E2> SIMDPP_INL |
85 | mask_int64<N,expr_empty> cmp_ge(const int64<N,E1>& a, |
86 | const int64<N,E2>& b) |
87 | { |
88 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
89 | } |
90 | |
91 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int64, int64) |
92 | |
93 | template<unsigned N, class E1, class E2> SIMDPP_INL |
94 | mask_int64<N,expr_empty> cmp_ge(const uint64<N,E1>& a, |
95 | const uint64<N,E2>& b) |
96 | { |
97 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
98 | } |
99 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int64, uint64) |
100 | |
101 | /** Compares the values of two float32x4 vectors for greater-than or equal |
102 | |
103 | @code |
104 | r0 = (a0 >= b0) ? 0xffffffff : 0x0 |
105 | ... |
106 | rN = (aN >= bN) ? 0xffffffff : 0x0 |
107 | @endcode |
108 | |
109 | @par 256-bit version: |
110 | @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2} |
111 | */ |
112 | template<unsigned N, class E1, class E2> SIMDPP_INL |
113 | mask_float32<N,expr_empty> cmp_ge(const float32<N,E1>& a, |
114 | const float32<N,E2>& b) |
115 | { |
116 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
117 | } |
118 | |
119 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_float32, float32) |
120 | |
121 | /** Compares the values of two float64x2 vectors for greater-than |
122 | |
123 | @code |
124 | r0 = (a0 >= b0) ? 0xffffffffffffffff : 0x0 |
125 | ... |
126 | rN = (aN >= bN) ? 0xffffffffffffffff : 0x0 |
127 | @endcode |
128 | |
129 | @par 128-bit version: |
130 | @novec{NEON, ALTIVEC} |
131 | |
132 | @par 256-bit version: |
133 | @novec{NEON, ALTIVEC} |
134 | @icost{SSE2-SSE4.1, 2} |
135 | */ |
136 | template<unsigned N, class E1, class E2> SIMDPP_INL |
137 | mask_float64<N,expr_empty> cmp_ge(const float64<N,E1>& a, |
138 | const float64<N,E2>& b) |
139 | { |
140 | return detail::insn::i_cmp_ge(a.eval(), b.eval()); |
141 | } |
142 | |
143 | SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_float64, float64) |
144 | |
145 | } // namespace SIMDPP_ARCH_NAMESPACE |
146 | } // namespace simdpp |
147 | |
148 | #endif |
149 | |
150 | |