1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++98, c++03, c++11, c++14
11
12 // <experimental/simd>
13 //
14 // [simd.traits]
15 // template <class T> struct ex::is_simd_mask;
16 // template <class T> inline constexpr bool ex::is_simd_mask_v =
17 // ex::is_simd_mask<T>::value;
18
19 #include <cstdint>
20 #include <experimental/simd>
21 #include "test_macros.h"
22
23 namespace ex = std::experimental::parallelism_v2;
24
25 struct UserType {};
26
27 static_assert(ex::is_simd_mask<ex::native_simd_mask<int8_t>>::value, "");
28 static_assert(ex::is_simd_mask<ex::native_simd_mask<int16_t>>::value, "");
29 static_assert(ex::is_simd_mask<ex::native_simd_mask<int32_t>>::value, "");
30 static_assert(ex::is_simd_mask<ex::native_simd_mask<int64_t>>::value, "");
31 static_assert(ex::is_simd_mask<ex::native_simd_mask<uint8_t>>::value, "");
32 static_assert(ex::is_simd_mask<ex::native_simd_mask<uint16_t>>::value, "");
33 static_assert(ex::is_simd_mask<ex::native_simd_mask<uint32_t>>::value, "");
34 static_assert(ex::is_simd_mask<ex::native_simd_mask<uint64_t>>::value, "");
35 static_assert(ex::is_simd_mask<ex::native_simd_mask<float>>::value, "");
36 static_assert(ex::is_simd_mask<ex::native_simd_mask<double>>::value, "");
37
38 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int8_t, 1>>::value, "");
39 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int16_t, 1>>::value,
40 "");
41 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int32_t, 1>>::value,
42 "");
43 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int64_t, 1>>::value,
44 "");
45 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint8_t, 1>>::value,
46 "");
47 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint16_t, 1>>::value,
48 "");
49 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint32_t, 1>>::value,
50 "");
51 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint64_t, 1>>::value,
52 "");
53 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<float, 1>>::value, "");
54 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<double, 1>>::value, "");
55
56 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int8_t, 3>>::value, "");
57 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int16_t, 3>>::value,
58 "");
59 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int32_t, 3>>::value,
60 "");
61 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int64_t, 3>>::value,
62 "");
63 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint8_t, 3>>::value,
64 "");
65 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint16_t, 3>>::value,
66 "");
67 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint32_t, 3>>::value,
68 "");
69 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint64_t, 3>>::value,
70 "");
71 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<float, 3>>::value, "");
72 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<double, 3>>::value, "");
73
74 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int8_t, 32>>::value,
75 "");
76 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int16_t, 32>>::value,
77 "");
78 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int32_t, 32>>::value,
79 "");
80 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<int64_t, 32>>::value,
81 "");
82 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint8_t, 32>>::value,
83 "");
84 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint16_t, 32>>::value,
85 "");
86 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint32_t, 32>>::value,
87 "");
88 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<uint64_t, 32>>::value,
89 "");
90 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<float, 32>>::value, "");
91 static_assert(ex::is_simd_mask<ex::fixed_size_simd_mask<double, 32>>::value,
92 "");
93
94 static_assert(!ex::is_simd_mask<void>::value, "");
95 static_assert(!ex::is_simd_mask<int>::value, "");
96 static_assert(!ex::is_simd_mask<float>::value, "");
97 static_assert(!ex::is_simd_mask<ex::simd<int>>::value, "");
98 static_assert(!ex::is_simd_mask<ex::simd<float>>::value, "");
99 static_assert(!ex::is_simd_mask<UserType>::value, "");
100
101 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<int8_t>>, "");
102 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<int16_t>>, "");
103 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<int32_t>>, "");
104 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<int64_t>>, "");
105 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<uint8_t>>, "");
106 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<uint16_t>>, "");
107 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<uint32_t>>, "");
108 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<uint64_t>>, "");
109 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<float>>, "");
110 static_assert(ex::is_simd_mask_v<ex::native_simd_mask<double>>, "");
111
112 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int8_t, 1>>, "");
113 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int16_t, 1>>, "");
114 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int32_t, 1>>, "");
115 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int64_t, 1>>, "");
116 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint8_t, 1>>, "");
117 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint16_t, 1>>, "");
118 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint32_t, 1>>, "");
119 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint64_t, 1>>, "");
120 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<float, 1>>, "");
121 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<double, 1>>, "");
122
123 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int8_t, 3>>, "");
124 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int16_t, 3>>, "");
125 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int32_t, 3>>, "");
126 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int64_t, 3>>, "");
127 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint8_t, 3>>, "");
128 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint16_t, 3>>, "");
129 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint32_t, 3>>, "");
130 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint64_t, 3>>, "");
131 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<float, 3>>, "");
132 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<double, 3>>, "");
133
134 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int8_t, 32>>, "");
135 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int16_t, 32>>, "");
136 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int32_t, 32>>, "");
137 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<int64_t, 32>>, "");
138 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint8_t, 32>>, "");
139 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint16_t, 32>>, "");
140 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint32_t, 32>>, "");
141 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<uint64_t, 32>>, "");
142 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<float, 32>>, "");
143 static_assert(ex::is_simd_mask_v<ex::fixed_size_simd_mask<double, 32>>, "");
144
145 static_assert(!ex::is_simd_mask_v<void>, "");
146 static_assert(!ex::is_simd_mask_v<int>, "");
147 static_assert(!ex::is_simd_mask_v<float>, "");
148 static_assert(!ex::is_simd_mask_v<ex::simd<int>>, "");
149 static_assert(!ex::is_simd_mask_v<ex::simd<float>>, "");
150 static_assert(!ex::is_simd_mask_v<UserType>, "");
151
main()152 int main() {}
153