1 | /* Copyright (C) 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_DETAIL_EXPR_BROADCAST_H |
9 | #define LIBSIMDPP_SIMDPP_DETAIL_EXPR_BROADCAST_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/splat_n.h> |
17 | |
18 | namespace simdpp { |
19 | namespace SIMDPP_ARCH_NAMESPACE { |
20 | namespace detail { |
21 | |
22 | template<class R, unsigned S, class E> |
23 | struct expr_eval<R, expr_splat2<S, E>> { |
24 | static SIMDPP_INL R eval(const expr_splat2<S, E>& e) |
25 | { |
26 | return insn::i_splat2<S>(e.a.eval()); |
27 | } |
28 | }; |
29 | |
30 | template<class R, unsigned S, class E> |
31 | struct expr_eval<R, expr_splat4<S, E>> { |
32 | static SIMDPP_INL R eval(const expr_splat4<S, E>& e) |
33 | { |
34 | return insn::i_splat4<S>(e.a.eval()); |
35 | } |
36 | }; |
37 | |
38 | template<class R, unsigned S, class E> |
39 | struct expr_eval<R, expr_splat8<S, E>> { |
40 | static SIMDPP_INL R eval(const expr_splat8<S, E>& e) |
41 | { |
42 | return insn::i_splat8<S>(e.a.eval()); |
43 | } |
44 | }; |
45 | |
46 | template<class R, unsigned S, class E> |
47 | struct expr_eval<R, expr_splat16<S, E>> { |
48 | static SIMDPP_INL R eval(const expr_splat16<S, E>& e) |
49 | { |
50 | return insn::i_splat16<S>(e.a.eval()); |
51 | } |
52 | }; |
53 | |
54 | } // namespace detail |
55 | } // namespace SIMDPP_ARCH_NAMESPACE |
56 | } // namespace simdpp |
57 | |
58 | #endif |
59 | |
60 | |