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_CORE_SET_SPLAT_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_SET_SPLAT_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/set_splat.h> |
17 | |
18 | namespace simdpp { |
19 | namespace SIMDPP_ARCH_NAMESPACE { |
20 | |
21 | /** Loads a value from a register and broadcasts it to all elements of a vector. |
22 | The argument value is converted to the element of the resulting vector using |
23 | standard conversions. |
24 | |
25 | @code |
26 | r0 = a |
27 | ... |
28 | rN = a |
29 | @endcode |
30 | */ |
31 | // FIXME: return empty expression |
32 | SIMDPP_INL expr_vec_set_splat<uint32_t> splat(unsigned x) { return { x }; } |
33 | SIMDPP_INL expr_vec_set_splat<uint64_t> splat(unsigned long x) { return { x }; } |
34 | SIMDPP_INL expr_vec_set_splat<uint64_t> splat(unsigned long long x) { return { x }; } |
35 | SIMDPP_INL expr_vec_set_splat<int32_t> splat(int x) { return { x }; } |
36 | SIMDPP_INL expr_vec_set_splat<int64_t> splat(long x) { return { x }; } |
37 | SIMDPP_INL expr_vec_set_splat<int64_t> splat(long long x) { return { x }; } |
38 | SIMDPP_INL expr_vec_set_splat<float> splat(float x) { return { x }; } |
39 | SIMDPP_INL expr_vec_set_splat<double> splat(double x) { return { x }; } |
40 | |
41 | template<class V> SIMDPP_INL V splat(unsigned x) { return detail::splat_impl<V>(x); } |
42 | template<class V> SIMDPP_INL V splat(unsigned long x) { return detail::splat_impl<V>(x); } |
43 | template<class V> SIMDPP_INL V splat(unsigned long long x) { return detail::splat_impl<V>(x); } |
44 | template<class V> SIMDPP_INL V splat(int x) { return detail::splat_impl<V>(x); } |
45 | template<class V> SIMDPP_INL V splat(long x) { return detail::splat_impl<V>(x); } |
46 | template<class V> SIMDPP_INL V splat(long long x) { return detail::splat_impl<V>(x); } |
47 | template<class V> SIMDPP_INL V splat(float x) { return detail::splat_impl<V>(x); } |
48 | template<class V> SIMDPP_INL V splat(double x) { return detail::splat_impl<V>(x); } |
49 | |
50 | } // namespace SIMDPP_ARCH_NAMESPACE |
51 | } // namespace simdpp |
52 | |
53 | #endif |
54 | |
55 |