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
19namespace simdpp {
20namespace 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*/
30template<unsigned N, class E1, class E2> SIMDPP_INL
31mask_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
37SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, int8)
38
39template<unsigned N, class E1, class E2> SIMDPP_INL
40mask_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
46SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, uint8)
47
48template<unsigned N, class E1, class E2> SIMDPP_INL
49mask_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
55SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, int16)
56
57template<unsigned N, class E1, class E2> SIMDPP_INL
58mask_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
64SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, uint16)
65
66template<unsigned N, class E1, class E2> SIMDPP_INL
67mask_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
73SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, int32)
74
75template<unsigned N, class E1, class E2> SIMDPP_INL
76mask_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
82SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, uint32)
83
84template<unsigned N, class E1, class E2> SIMDPP_INL
85mask_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
91SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int64, int64)
92
93template<unsigned N, class E1, class E2> SIMDPP_INL
94mask_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}
99SIMDPP_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*/
112template<unsigned N, class E1, class E2> SIMDPP_INL
113mask_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
119SIMDPP_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*/
136template<unsigned N, class E1, class E2> SIMDPP_INL
137mask_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
143SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_float64, float64)
144
145} // namespace SIMDPP_ARCH_NAMESPACE
146} // namespace simdpp
147
148#endif
149
150