@@ -33,7 +33,6 @@ static_assert(LIBC_HAS_VECTOR_TYPE, "compiler does not support vector types");
33
33
namespace internal {
34
34
35
35
template <size_t Size> struct get_as_integer_type ;
36
-
37
36
template <> struct get_as_integer_type <1 > {
38
37
using type = uint8_t ;
39
38
};
@@ -46,7 +45,6 @@ template <> struct get_as_integer_type<4> {
46
45
template <> struct get_as_integer_type <8 > {
47
46
using type = uint64_t ;
48
47
};
49
-
50
48
template <class T >
51
49
using get_as_integer_type_t = typename get_as_integer_type<sizeof (T)>::type;
52
50
@@ -75,21 +73,18 @@ using simd_mask = simd<bool, internal::native_vector_size<T>>;
75
73
// Type trait helpers.
76
74
template <typename T> struct simd_size : cpp::integral_constant<size_t , 1 > {};
77
75
template <typename T, unsigned N>
78
- struct simd_size <T [[clang::ext_vector_type(N)]]>
79
- : cpp::integral_constant<size_t , N> {};
76
+ struct simd_size <simd<T, N>> : cpp::integral_constant<size_t , N> {};
80
77
template <class T > constexpr size_t simd_size_v = simd_size<T>::value;
81
78
82
79
template <typename T> struct is_simd : cpp::integral_constant<bool , false > {};
83
80
template <typename T, unsigned N>
84
- struct is_simd <T [[clang::ext_vector_type(N)]]>
85
- : cpp::integral_constant<bool , true > {};
81
+ struct is_simd <simd<T, N>> : cpp::integral_constant<bool , true > {};
86
82
template <class T > constexpr bool is_simd_v = is_simd<T>::value;
87
83
88
84
template <typename T>
89
85
struct is_simd_mask : cpp::integral_constant<bool , false > {};
90
86
template <unsigned N>
91
- struct is_simd_mask <bool [[clang::ext_vector_type(N)]]>
92
- : cpp::integral_constant<bool , true > {};
87
+ struct is_simd_mask <simd<bool , N>> : cpp::integral_constant<bool , true > {};
93
88
template <class T > constexpr bool is_simd_mask_v = is_simd_mask<T>::value;
94
89
95
90
template <typename T>
@@ -176,27 +171,27 @@ LIBC_INLINE enable_if_simd_t<T> load_unaligned(const void *ptr) {
176
171
}
177
172
template <typename T>
178
173
LIBC_INLINE enable_if_simd_t <T> load_aligned (const void *ptr) {
179
- return * reinterpret_cast <T * >(__builtin_assume_aligned (ptr, alignof (T)));
174
+ return load_unaligned<T >(__builtin_assume_aligned (ptr, alignof (T)));
180
175
}
181
176
template <typename T>
182
177
LIBC_INLINE enable_if_simd_t <T> store_unaligned (T v, void *ptr) {
183
178
__builtin_memcpy (ptr, &v, sizeof (T));
184
179
}
185
180
template <typename T>
186
181
LIBC_INLINE enable_if_simd_t <T> store_aligned (T v, void *ptr) {
187
- * reinterpret_cast <T *>( __builtin_assume_aligned (ptr, alignof (T))) = v ;
182
+ store_unaligned<T>(v, __builtin_assume_aligned (ptr, alignof (T)));
188
183
}
189
184
template <typename T>
190
185
LIBC_INLINE enable_if_simd_t <T> masked_load (simd<bool , simd_size_v<T>> m,
191
186
void *ptr) {
192
187
return __builtin_masked_load (
193
- m, reinterpret_cast <T *>(__builtin_assume_aligned (ptr, alignof (T))));
188
+ m, static_cast <T *>(__builtin_assume_aligned (ptr, alignof (T))));
194
189
}
195
190
template <typename T>
196
191
LIBC_INLINE enable_if_simd_t <T> masked_store (simd<bool , simd_size_v<T>> m, T v,
197
192
void *ptr) {
198
193
__builtin_masked_store (
199
- m, v, reinterpret_cast <T *>(__builtin_assume_aligned (ptr, alignof (T))));
194
+ m, v, static_cast <T *>(__builtin_assume_aligned (ptr, alignof (T))));
200
195
}
201
196
202
197
// Construction helpers.
0 commit comments