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