| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /* Copyright (C) 2013-2014 Povilas Kanapickas <[email protected]>
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
- */
- #ifndef LIBSIMDPP_SIMDPP_CORE_F_ADD_H
- #define LIBSIMDPP_SIMDPP_CORE_F_ADD_H
- #ifndef LIBSIMDPP_SIMD_H
- #error "This file must be included through simd.h"
- #endif
- #include <simdpp/types.h>
- #include <simdpp/detail/expr/f_add.h>
- #include <simdpp/core/detail/scalar_arg_impl.h>
- namespace simdpp {
- namespace SIMDPP_ARCH_NAMESPACE {
- /** Adds the values of two vectors
- @code
- r0 = a0 + b0
- ...
- rN = aN + bN
- @endcode
- @par 256-bit version:
- @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
- */
- template<unsigned N, class E1, class E2> SIMDPP_INL
- float32<N, expr_fadd<float32<N,E1>,
- float32<N,E2>>> add(const float32<N,E1>& a, const float32<N,E2>& b)
- {
- return { { a, b } };
- }
- SIMDPP_SCALAR_ARG_IMPL_EXPR(add, expr_fadd, float32, float32)
- /** Adds the values of two vectors
- @code
- r0 = a0 + b0
- ...
- rN = aN + bN
- @endcode
- @par 128-bit version:
- @novec{NEON, ALTIVEC}
- @par 256-bit version:
- @novec{NEON, ALTIVEC}
- @icost{SSE2-SSE4.1, 2}
- */
- template<unsigned N, class E1, class E2> SIMDPP_INL
- float64<N, expr_fadd<float64<N,E1>,
- float64<N,E2>>> add(const float64<N,E1>& a, const float64<N,E2>& b)
- {
- return { { a, b } };
- }
- SIMDPP_SCALAR_ARG_IMPL_EXPR(add, expr_fadd, float64, float64)
- } // namespace SIMDPP_ARCH_NAMESPACE
- } // namespace simdpp
- #endif
|