Skip to content

Commit 5431ec2

Browse files
authored
Neon nitpicks (xtensor-stack#1331)
1 parent 1c6c7f0 commit 5431ec2

3 files changed

Lines changed: 79 additions & 9 deletions

File tree

include/xsimd/arch/xsimd_neon.hpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ namespace xsimd
5454
namespace wrap
5555
{
5656
// TODO(c++17): Make a single function with if constexpr switch
57+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
58+
// the vector types are all aliases of the same type.
5759
template <class R, class T, std::enable_if_t<std::is_same<R, uint8_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
5860
XSIMD_INLINE uint8x16_t x_vreinterpretq(uint8x16_t a) noexcept { return a; }
5961
template <class R, class T, std::enable_if_t<std::is_same<R, uint8_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -74,6 +76,8 @@ namespace xsimd
7476
XSIMD_INLINE uint8x16_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_u8_f32(a); }
7577

7678
// TODO(c++17): Make a single function with if constexpr switch
79+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
80+
// the vector types are all aliases of the same type.
7781
template <class R, class T, std::enable_if_t<std::is_same<R, int8_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
7882
XSIMD_INLINE int8x16_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_s8_u8(a); }
7983
template <class R, class T, std::enable_if_t<std::is_same<R, int8_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -94,6 +98,8 @@ namespace xsimd
9498
XSIMD_INLINE int8x16_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_s8_f32(a); }
9599

96100
// TODO(c++17): Make a single function with if constexpr switch
101+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
102+
// the vector types are all aliases of the same type.
97103
template <class R, class T, std::enable_if_t<std::is_same<R, uint16_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
98104
XSIMD_INLINE uint16x8_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_u16_u8(a); }
99105
template <class R, class T, std::enable_if_t<std::is_same<R, uint16_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -114,6 +120,8 @@ namespace xsimd
114120
XSIMD_INLINE uint16x8_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_u16_f32(a); }
115121

116122
// TODO(c++17): Make a single function with if constexpr switch
123+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
124+
// the vector types are all aliases of the same type.
117125
template <class R, class T, std::enable_if_t<std::is_same<R, int16_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
118126
XSIMD_INLINE int16x8_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_s16_u8(a); }
119127
template <class R, class T, std::enable_if_t<std::is_same<R, int16_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -134,6 +142,8 @@ namespace xsimd
134142
XSIMD_INLINE int16x8_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_s16_f32(a); }
135143

136144
// TODO(c++17): Make a single function with if constexpr switch
145+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
146+
// the vector types are all aliases of the same type.
137147
template <class R, class T, std::enable_if_t<std::is_same<R, uint32_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
138148
XSIMD_INLINE uint32x4_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_u32_u8(a); }
139149
template <class R, class T, std::enable_if_t<std::is_same<R, uint32_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -154,6 +164,8 @@ namespace xsimd
154164
XSIMD_INLINE uint32x4_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_u32_f32(a); }
155165

156166
// TODO(c++17): Make a single function with if constexpr switch
167+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
168+
// the vector types are all aliases of the same type.
157169
template <class R, class T, std::enable_if_t<std::is_same<R, int32_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
158170
XSIMD_INLINE int32x4_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_s32_u8(a); }
159171
template <class R, class T, std::enable_if_t<std::is_same<R, int32_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -174,6 +186,8 @@ namespace xsimd
174186
XSIMD_INLINE int32x4_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_s32_f32(a); }
175187

176188
// TODO(c++17): Make a single function with if constexpr switch
189+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
190+
// the vector types are all aliases of the same type.
177191
template <class R, class T, std::enable_if_t<std::is_same<R, uint64_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
178192
XSIMD_INLINE uint64x2_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_u64_u8(a); }
179193
template <class R, class T, std::enable_if_t<std::is_same<R, uint64_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -194,6 +208,8 @@ namespace xsimd
194208
XSIMD_INLINE uint64x2_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_u64_f32(a); }
195209

196210
// TODO(c++17): Make a single function with if constexpr switch
211+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
212+
// the vector types are all aliases of the same type.
197213
template <class R, class T, std::enable_if_t<std::is_same<R, int64_t>::value && std::is_same<T, uint8_t>::value, int> = 0>
198214
XSIMD_INLINE int64x2_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_s64_u8(a); }
199215
template <class R, class T, std::enable_if_t<std::is_same<R, int64_t>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -214,6 +230,8 @@ namespace xsimd
214230
XSIMD_INLINE int64x2_t x_vreinterpretq(float32x4_t a) noexcept { return vreinterpretq_s64_f32(a); }
215231

216232
// TODO(c++17): Make a single function with if constexpr switch
233+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
234+
// the vector types are all aliases of the same type.
217235
template <class R, class T, std::enable_if_t<std::is_same<R, float>::value && std::is_same<T, uint8_t>::value, int> = 0>
218236
XSIMD_INLINE float32x4_t x_vreinterpretq(uint8x16_t a) noexcept { return vreinterpretq_f32_u8(a); }
219237
template <class R, class T, std::enable_if_t<std::is_same<R, float>::value && std::is_same<T, int8_t>::value, int> = 0>
@@ -802,6 +820,8 @@ namespace xsimd
802820
namespace wrap
803821
{
804822
// TODO(c++17): Make a single function with if constexpr switch
823+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
824+
// the vector types are all aliases of the same type.
805825
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
806826
XSIMD_INLINE uint8x16_t x_vaddq(uint8x16_t a, uint8x16_t b) noexcept { return vaddq_u8(a, b); }
807827
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -836,6 +856,8 @@ namespace xsimd
836856
namespace wrap
837857
{
838858
// TODO(c++17): Make a single function with if constexpr switch
859+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
860+
// the vector types are all aliases of the same type.
839861
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
840862
XSIMD_INLINE uint8x16_t x_vhaddq(uint8x16_t a, uint8x16_t b) noexcept { return vhaddq_u8(a, b); }
841863
template <class T, std::enable_if_t<std::is_same<T, uint16_t>::value, int> = 0>
@@ -858,6 +880,8 @@ namespace xsimd
858880
namespace wrap
859881
{
860882
// TODO(c++17): Make a single function with if constexpr switch
883+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
884+
// the vector types are all aliases of the same type.
861885
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
862886
XSIMD_INLINE uint8x16_t x_vrhaddq(uint8x16_t a, uint8x16_t b) noexcept { return vrhaddq_u8(a, b); }
863887
template <class T, std::enable_if_t<std::is_same<T, uint16_t>::value, int> = 0>
@@ -880,6 +904,8 @@ namespace xsimd
880904
namespace wrap
881905
{
882906
// TODO(c++17): Make a single function with if constexpr switch
907+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
908+
// the vector types are all aliases of the same type.
883909
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
884910
XSIMD_INLINE uint8x16_t x_vqaddq(uint8x16_t a, uint8x16_t b) noexcept { return vqaddq_u8(a, b); }
885911
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -914,6 +940,8 @@ namespace xsimd
914940
namespace wrap
915941
{
916942
// TODO(c++17): Make a single function with if constexpr switch
943+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
944+
// the vector types are all aliases of the same type.
917945
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
918946
XSIMD_INLINE uint8x16_t x_vsubq(uint8x16_t a, uint8x16_t b) noexcept { return vsubq_u8(a, b); }
919947
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -948,6 +976,8 @@ namespace xsimd
948976
namespace wrap
949977
{
950978
// TODO(c++17): Make a single function with if constexpr switch
979+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
980+
// the vector types are all aliases of the same type.
951981
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
952982
XSIMD_INLINE uint8x16_t x_vqsubq(uint8x16_t a, uint8x16_t b) noexcept { return vqsubq_u8(a, b); }
953983
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -982,6 +1012,8 @@ namespace xsimd
9821012
namespace wrap
9831013
{
9841014
// TODO(c++17): Make a single function with if constexpr switch
1015+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1016+
// the vector types are all aliases of the same type.
9851017
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
9861018
XSIMD_INLINE uint8x16_t x_vmulq(uint8x16_t a, uint8x16_t b) noexcept { return vmulq_u8(a, b); }
9871019
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1047,6 +1079,8 @@ namespace xsimd
10471079
namespace wrap
10481080
{
10491081
// TODO(c++17): Make a single function with if constexpr switch
1082+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1083+
// the vector types are all aliases of the same type.
10501084
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
10511085
XSIMD_INLINE uint8x16_t x_vceqq(uint8x16_t a, uint8x16_t b) noexcept { return vceqq_u8(a, b); }
10521086
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1140,6 +1174,8 @@ namespace xsimd
11401174
namespace wrap
11411175
{
11421176
// TODO(c++17): Make a single function with if constexpr switch
1177+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1178+
// the vector types are all aliases of the same type.
11431179
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
11441180
XSIMD_INLINE uint8x16_t x_vcltq(uint8x16_t a, uint8x16_t b) noexcept { return vcltq_u8(a, b); }
11451181
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1185,6 +1221,8 @@ namespace xsimd
11851221
namespace wrap
11861222
{
11871223
// TODO(c++17): Make a single function with if constexpr switch
1224+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1225+
// the vector types are all aliases of the same type.
11881226
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
11891227
XSIMD_INLINE uint8x16_t x_vcleq(uint8x16_t a, uint8x16_t b) noexcept { return vcleq_u8(a, b); }
11901228
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1221,6 +1259,8 @@ namespace xsimd
12211259
namespace wrap
12221260
{
12231261
// TODO(c++17): Make a single function with if constexpr switch
1262+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1263+
// the vector types are all aliases of the same type.
12241264
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
12251265
XSIMD_INLINE uint8x16_t x_vcgtq(uint8x16_t a, uint8x16_t b) noexcept { return vcgtq_u8(a, b); }
12261266
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1266,6 +1306,8 @@ namespace xsimd
12661306
namespace wrap
12671307
{
12681308
// TODO(c++17): Make a single function with if constexpr switch
1309+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1310+
// the vector types are all aliases of the same type.
12691311
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
12701312
XSIMD_INLINE uint8x16_t x_vcgeq(uint8x16_t a, uint8x16_t b) noexcept { return vcgeq_u8(a, b); }
12711313
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1313,6 +1355,8 @@ namespace xsimd
13131355
namespace wrap
13141356
{
13151357
// TODO(c++17): Make a single function with if constexpr switch
1358+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1359+
// the vector types are all aliases of the same type.
13161360
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
13171361
XSIMD_INLINE uint8x16_t x_vandq(uint8x16_t a, uint8x16_t b) noexcept { return vandq_u8(a, b); }
13181362
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1358,6 +1402,8 @@ namespace xsimd
13581402
namespace wrap
13591403
{
13601404
// TODO(c++17): Make a single function with if constexpr switch
1405+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1406+
// the vector types are all aliases of the same type.
13611407
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
13621408
XSIMD_INLINE uint8x16_t x_vorrq(uint8x16_t a, uint8x16_t b) noexcept { return vorrq_u8(a, b); }
13631409
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1403,6 +1449,8 @@ namespace xsimd
14031449
namespace wrap
14041450
{
14051451
// TODO(c++17): Make a single function with if constexpr switch
1452+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1453+
// the vector types are all aliases of the same type.
14061454
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
14071455
XSIMD_INLINE uint8x16_t x_veorq(uint8x16_t a, uint8x16_t b) noexcept { return veorq_u8(a, b); }
14081456
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1458,6 +1506,8 @@ namespace xsimd
14581506
namespace wrap
14591507
{
14601508
// TODO(c++17): Make a single function with if constexpr switch
1509+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1510+
// the vector types are all aliases of the same type.
14611511
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
14621512
XSIMD_INLINE uint8x16_t x_vmvnq(uint8x16_t a) noexcept { return vmvnq_u8(a); }
14631513
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1508,6 +1558,8 @@ namespace xsimd
15081558
namespace wrap
15091559
{
15101560
// TODO(c++17): Make a single function with if constexpr switch
1561+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1562+
// the vector types are all aliases of the same type.
15111563
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
15121564
XSIMD_INLINE uint8x16_t x_vbicq(uint8x16_t a, uint8x16_t b) noexcept { return vbicq_u8(a, b); }
15131565
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1552,6 +1604,8 @@ namespace xsimd
15521604
namespace wrap
15531605
{
15541606
// TODO(c++17): Make a single function with if constexpr switch
1607+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1608+
// the vector types are all aliases of the same type.
15551609
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
15561610
XSIMD_INLINE uint8x16_t x_vminq(uint8x16_t a, uint8x16_t b) noexcept { return vminq_u8(a, b); }
15571611
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1588,6 +1642,8 @@ namespace xsimd
15881642
namespace wrap
15891643
{
15901644
// TODO(c++17): Make a single function with if constexpr switch
1645+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1646+
// the vector types are all aliases of the same type.
15911647
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
15921648
XSIMD_INLINE uint8x16_t x_vmaxq(uint8x16_t a, uint8x16_t b) noexcept { return vmaxq_u8(a, b); }
15931649
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1624,6 +1680,8 @@ namespace xsimd
16241680
namespace wrap
16251681
{
16261682
// TODO(c++17): Make a single function with if constexpr switch
1683+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
1684+
// the vector types are all aliases of the same type.
16271685
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
16281686
XSIMD_INLINE uint8x16_t x_vabsq(uint8x16_t a) noexcept { return a; }
16291687
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -1967,6 +2025,8 @@ namespace xsimd
19672025
namespace wrap
19682026
{
19692027
// TODO(c++17): Make a single function with if constexpr switch
2028+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
2029+
// the vector types are all aliases of the same type.
19702030
template <class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
19712031
XSIMD_INLINE uint8x16_t x_vbslq(uint8x16_t a, uint8x16_t b, uint8x16_t c) noexcept { return vbslq_u8(a, b, c); }
19722032
template <class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>
@@ -3096,6 +3156,8 @@ namespace xsimd
30963156
namespace wrap
30973157
{
30983158
// TODO(c++17): Make a single function with if constexpr switch
3159+
// Templating on the scalar type `T` is required because in some compilers (e.g. MSVC)
3160+
// the vector types are all aliases of the same type.
30993161
template <size_t N, class T, std::enable_if_t<std::is_same<T, uint8_t>::value, int> = 0>
31003162
XSIMD_INLINE uint8x16_t x_rotate_left(uint8x16_t a, uint8x16_t b) noexcept { return vextq_u8(a, b, N); }
31013163
template <size_t N, class T, std::enable_if_t<std::is_same<T, int8_t>::value, int> = 0>

0 commit comments

Comments
 (0)