1// This file is generated by tools/gen_operators.pl. CHANGES WILL BE OVERWRITTEN
2/* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt>
3
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7*/
8
9#ifndef LIBSIMDPP_SIMDPP_CORE_BIT_AND_OPERATOR_H
10#define LIBSIMDPP_SIMDPP_CORE_BIT_AND_OPERATOR_H
11
12#ifndef LIBSIMDPP_SIMD_H
13 #error "This file must be included through simd.h"
14#endif
15
16#include <simdpp/types.h>
17#include <simdpp/detail/insn/bit_and.h>
18#include <simdpp/detail/expr/bit_and.h>
19#include <simdpp/detail/get_expr.h>
20#include <simdpp/core/detail/get_expr_bitwise.h>
21#include <simdpp/core/detail/scalar_arg_impl.h>
22
23namespace simdpp {
24namespace SIMDPP_ARCH_NAMESPACE {
25
26/** Computes bitwise AND of integer or floating-point vectors.
27
28 @code
29 r0 = a0 & b0
30 ...
31 rN = aN & bN
32 @endcode
33
34 @todo: icost
35*/
36template<unsigned N, class V1, class V2> SIMDPP_INL
37typename detail::get_expr_bitwise2_and<expr_bit_and, V1, V2>::type
38 operator&(const any_vec<N,V1>& a,
39 const any_vec<N,V2>& b)
40{
41 return { { a.wrapped(), b.wrapped() } };
42}
43
44// support scalar arguments
45template<unsigned N, class V> SIMDPP_INL
46typename detail::get_expr_bitwise2_and<expr_bit_and, unsigned, V>::type
47 operator&(const unsigned& a, const any_vec<N,V>& b)
48{
49 return { { a, b.wrapped() } };
50}
51template<unsigned N, class V> SIMDPP_INL
52typename detail::get_expr_bitwise2_and<expr_bit_and, unsigned long, V>::type
53 operator&(const unsigned long& a, const any_vec<N,V>& b)
54{
55 return { { a, b.wrapped() } };
56}
57template<unsigned N, class V> SIMDPP_INL
58typename detail::get_expr_bitwise2_and<expr_bit_and, unsigned long long, V>::type
59 operator&(const unsigned long long& a, const any_vec<N,V>& b)
60{
61 return { { a, b.wrapped() } };
62}
63template<unsigned N, class V> SIMDPP_INL
64typename detail::get_expr_bitwise2_and<expr_bit_and, int, V>::type
65 operator&(const int& a, const any_vec<N,V>& b)
66{
67 return { { a, b.wrapped() } };
68}
69template<unsigned N, class V> SIMDPP_INL
70typename detail::get_expr_bitwise2_and<expr_bit_and, long, V>::type
71 operator&(const long& a, const any_vec<N,V>& b)
72{
73 return { { a, b.wrapped() } };
74}
75template<unsigned N, class V> SIMDPP_INL
76typename detail::get_expr_bitwise2_and<expr_bit_and, long long, V>::type
77 operator&(const long long& a, const any_vec<N,V>& b)
78{
79 return { { a, b.wrapped() } };
80}
81
82template<unsigned N, class V> SIMDPP_INL
83typename detail::get_expr_bitwise2_and<expr_bit_and, V, unsigned>::type
84 operator&(const any_vec<N,V>& a, const unsigned& b)
85{
86 return { { a.wrapped(), b } };
87}
88template<unsigned N, class V> SIMDPP_INL
89typename detail::get_expr_bitwise2_and<expr_bit_and, V, unsigned long>::type
90 operator&(const any_vec<N,V>& a, const unsigned long& b)
91{
92 return { { a.wrapped(), b } };
93}
94template<unsigned N, class V> SIMDPP_INL
95typename detail::get_expr_bitwise2_and<expr_bit_and, V, unsigned long long>::type
96 operator&(const any_vec<N,V>& a, const unsigned long long& b)
97{
98 return { { a.wrapped(), b } };
99}
100template<unsigned N, class V> SIMDPP_INL
101typename detail::get_expr_bitwise2_and<expr_bit_and, V, int>::type
102 operator&(const any_vec<N,V>& a, const int& b)
103{
104 return { { a.wrapped(), b } };
105}
106template<unsigned N, class V> SIMDPP_INL
107typename detail::get_expr_bitwise2_and<expr_bit_and, V, long>::type
108 operator&(const any_vec<N,V>& a, const long& b)
109{
110 return { { a.wrapped(), b } };
111}
112template<unsigned N, class V> SIMDPP_INL
113typename detail::get_expr_bitwise2_and<expr_bit_and, V, long long>::type
114 operator&(const any_vec<N,V>& a, const long long& b)
115{
116 return { { a.wrapped(), b } };
117}
118
119
120} // namespace SIMDPP_ARCH_NAMESPACE
121} // namespace simdpp
122
123#endif
124
125