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_F_ADD_OPERATOR_H
10#define LIBSIMDPP_SIMDPP_CORE_F_ADD_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/expr/f_add.h>
18#include <simdpp/core/detail/scalar_arg_impl.h>
19
20namespace simdpp {
21namespace SIMDPP_ARCH_NAMESPACE {
22
23
24/** Adds the values of two vectors
25
26 @code
27 r0 = a0 + b0
28 ...
29 rN = aN + bN
30 @endcode
31
32 @par 256-bit version:
33 @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
34*/
35template<unsigned N, class E1, class E2> SIMDPP_INL
36float32<N, expr_fadd<float32<N,E1>,
37 float32<N,E2>>> operator+(const float32<N,E1>& a, const float32<N,E2>& b)
38{
39 return { { a, b } };
40}
41
42SIMDPP_SCALAR_ARG_IMPL_EXPR(operator+, expr_fadd, float32, float32)
43
44/** Adds the values of two vectors
45
46 @code
47 r0 = a0 + b0
48 ...
49 rN = aN + bN
50 @endcode
51
52 @par 128-bit version:
53 @novec{NEON, ALTIVEC}
54
55 @par 256-bit version:
56 @novec{NEON, ALTIVEC}
57 @icost{SSE2-SSE4.1, 2}
58*/
59template<unsigned N, class E1, class E2> SIMDPP_INL
60float64<N, expr_fadd<float64<N,E1>,
61 float64<N,E2>>> operator+(const float64<N,E1>& a, const float64<N,E2>& b)
62{
63 return { { a, b } };
64}
65
66SIMDPP_SCALAR_ARG_IMPL_EXPR(operator+, expr_fadd, float64, float64)
67
68} // namespace SIMDPP_ARCH_NAMESPACE
69} // namespace simdpp
70
71#endif
72
73