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_F_MUL_H
9#define LIBSIMDPP_SIMDPP_CORE_F_MUL_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/expr/f_mul.h>
17#include <simdpp/core/detail/scalar_arg_impl.h>
18
19namespace simdpp {
20namespace SIMDPP_ARCH_NAMESPACE {
21
22
23/** Multiplies the values of two vectors
24
25 @code
26 r0 = a0 * b0
27 ...
28 rN = aN * bN
29 @endcode
30
31 @par 256-bit version:
32 @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
33*/
34template<unsigned N, class E1, class E2> SIMDPP_INL
35float32<N, expr_fmul<float32<N,E1>,
36 float32<N,E2>>> mul(const float32<N,E1>& a,
37 const float32<N,E2>& b)
38{
39 return { { a, b } };
40}
41
42SIMDPP_SCALAR_ARG_IMPL_EXPR(mul, expr_fmul, float32, float32)
43
44/** Multiplies 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_fmul<float64<N,E1>,
61 float64<N,E2>>> mul(const float64<N,E1>& a,
62 const float64<N,E2>& b)
63{
64 return { { a, b } };
65}
66
67SIMDPP_SCALAR_ARG_IMPL_EXPR(mul, expr_fmul, float64, float64)
68
69} // namespace SIMDPP_ARCH_NAMESPACE
70} // namespace simdpp
71
72#endif
73
74