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
19namespace simdpp {
20namespace SIMDPP_ARCH_NAMESPACE {
21
22template<unsigned N, class E1, class E2> SIMDPP_INL
23mask_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
29SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int8, int8)
30
31template<unsigned N, class E1, class E2> SIMDPP_INL
32mask_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
38SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int8, uint8)
39
40template<unsigned N, class E1, class E2> SIMDPP_INL
41mask_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
47SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int16, int16)
48
49template<unsigned N, class E1, class E2> SIMDPP_INL
50mask_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
56SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int16, uint16)
57
58template<unsigned N, class E1, class E2> SIMDPP_INL
59mask_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
65SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int32, int32)
66
67template<unsigned N, class E1, class E2> SIMDPP_INL
68mask_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
74SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int32, uint32)
75
76template<unsigned N, class E1, class E2> SIMDPP_INL
77mask_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
83SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_int64, int64)
84
85template<unsigned N, class E1, class E2> SIMDPP_INL
86mask_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}
91SIMDPP_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*/
104template<unsigned N, class E1, class E2> SIMDPP_INL
105mask_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
111SIMDPP_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*/
128template<unsigned N, class E1, class E2> SIMDPP_INL
129mask_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
135SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_le, mask_float64, float64)
136
137} // namespace SIMDPP_ARCH_NAMESPACE
138} // namespace simdpp
139
140#endif
141
142