1 | /* Copyright (C) 2016 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_I_REDUCE_OR_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_I_REDUCE_OR_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/i_reduce_or.h> |
17 | |
18 | namespace simdpp { |
19 | namespace SIMDPP_ARCH_NAMESPACE { |
20 | |
21 | |
22 | /** Computes the bitwise OR of the elements in the vector |
23 | |
24 | @code |
25 | r0 = a0 & a1 & a2 & ... |
26 | @endcode |
27 | */ |
28 | template<unsigned N, class E> SIMDPP_INL |
29 | int8_t reduce_or(const int8<N,E>& a) |
30 | { |
31 | return detail::insn::i_reduce_or(uint8<N>(a.eval())); |
32 | } |
33 | |
34 | template<unsigned N, class E> SIMDPP_INL |
35 | uint8_t reduce_or(const uint8<N,E>& a) |
36 | { |
37 | return detail::insn::i_reduce_or(a.eval()); |
38 | } |
39 | |
40 | template<unsigned N, class E> SIMDPP_INL |
41 | int16_t reduce_or(const int16<N,E>& a) |
42 | { |
43 | return detail::insn::i_reduce_or(uint16<N>(a.eval())); |
44 | } |
45 | |
46 | template<unsigned N, class E> SIMDPP_INL |
47 | uint16_t reduce_or(const uint16<N,E>& a) |
48 | { |
49 | return detail::insn::i_reduce_or(a.eval()); |
50 | } |
51 | |
52 | template<unsigned N, class E> SIMDPP_INL |
53 | int32_t reduce_or(const int32<N,E>& a) |
54 | { |
55 | return detail::insn::i_reduce_or(uint32<N>(a.eval())); |
56 | } |
57 | |
58 | template<unsigned N, class E> SIMDPP_INL |
59 | uint32_t reduce_or(const uint32<N,E>& a) |
60 | { |
61 | return detail::insn::i_reduce_or(a.eval()); |
62 | } |
63 | |
64 | template<unsigned N, class E> SIMDPP_INL |
65 | int64_t reduce_or(const int64<N,E>& a) |
66 | { |
67 | return detail::insn::i_reduce_or(uint64<N>(a.eval())); |
68 | } |
69 | |
70 | template<unsigned N, class E> SIMDPP_INL |
71 | uint64_t reduce_or(const uint64<N,E>& a) |
72 | { |
73 | return detail::insn::i_reduce_or(a.eval()); |
74 | } |
75 | |
76 | } // namespace SIMDPP_ARCH_NAMESPACE |
77 | } // namespace simdpp |
78 | |
79 | #endif |
80 | |
81 | |