1 /*  Copyright (C) 2017  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_INSN_CONV_TO_MASK_H
9 #define LIBSIMDPP_SIMDPP_DETAIL_INSN_CONV_TO_MASK_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 
17 namespace simdpp {
18 namespace SIMDPP_ARCH_NAMESPACE {
19 namespace detail {
20 namespace insn {
21 
22 static SIMDPP_INL
23 mask_int8<16> i_to_mask(const uint8<16>& a);
24 
25 #if SIMDPP_USE_AVX2
26 static SIMDPP_INL
27 mask_int8<32> i_to_mask(const uint8<32>& a);
28 #endif
29 
30 #if SIMDPP_USE_AVX512BW
31 static SIMDPP_INL
32 mask_int8<64> i_to_mask(const uint8<64>& a);
33 #endif
34 
35 // -----------------------------------------------------------------------------
36 
37 static SIMDPP_INL
38 mask_int16<8> i_to_mask(const uint16<8>& a);
39 
40 #if SIMDPP_USE_AVX2
41 static SIMDPP_INL
42 mask_int16<16> i_to_mask(const uint16<16>& a);
43 #endif
44 
45 #if SIMDPP_USE_AVX512BW
46 static SIMDPP_INL
47 mask_int16<32> i_to_mask(const uint16<32>& a);
48 #endif
49 
50 // -----------------------------------------------------------------------------
51 
52 static SIMDPP_INL
53 mask_int32<4> i_to_mask(const uint32<4>& a);
54 
55 #if SIMDPP_USE_AVX2
56 static SIMDPP_INL
57 mask_int32<8> i_to_mask(const uint32<8>& a);
58 #endif
59 
60 #if SIMDPP_USE_AVX512F
61 static SIMDPP_INL
62 mask_int32<16> i_to_mask(const uint32<16>& a);
63 #endif
64 
65 // -----------------------------------------------------------------------------
66 
67 static SIMDPP_INL
68 mask_int64<2> i_to_mask(const uint64<2>& a);
69 
70 #if SIMDPP_USE_AVX2
71 static SIMDPP_INL
72 mask_int64<4> i_to_mask(const uint64<4>& a);
73 #endif
74 
75 #if SIMDPP_USE_AVX512F
76 static SIMDPP_INL
77 mask_int64<8> i_to_mask(const uint64<8>& a);
78 #endif
79 
80 // -----------------------------------------------------------------------------
81 
82 static SIMDPP_INL
83 mask_float32<4> i_to_mask(const float32<4>& a);
84 
85 #if SIMDPP_USE_AVX2
86 static SIMDPP_INL
87 mask_float32<8> i_to_mask(const float32<8>& a);
88 #endif
89 
90 #if SIMDPP_USE_AVX512F
91 static SIMDPP_INL
92 mask_float32<16> i_to_mask(const float32<16>& a);
93 #endif
94 
95 // -----------------------------------------------------------------------------
96 
97 static SIMDPP_INL
98 mask_float64<2> i_to_mask(const float64<2>& a);
99 
100 #if SIMDPP_USE_AVX2
101 static SIMDPP_INL
102 mask_float64<4> i_to_mask(const float64<4>& a);
103 #endif
104 
105 #if SIMDPP_USE_AVX512F
106 static SIMDPP_INL
107 mask_float64<8> i_to_mask(const float64<8>& a);
108 #endif
109 
110 // -----------------------------------------------------------------------------
111 
112 template<class V> SIMDPP_INL
113 typename V::mask_vector_type i_to_mask(const V& a);
114 
115 } // namespace insn
116 } // namespace detail
117 } // namespace SIMDPP_ARCH_NAMESPACE
118 } // namespace simdpp
119 
120 #endif
121 
122 
123