|
23 | 23 | // Wrap intrinsics so we can pass them as function pointers |
24 | 24 | // - OP: intrinsics name prefix, e.g., vorrq |
25 | 25 | // - RT: type traits to deduce intrinsics return types |
26 | | -#define WRAP_BINARY_INT_EXCLUDING_64(OP, RT) \ |
27 | | - namespace wrap \ |
28 | | - { \ |
29 | | - inline RT<uint8x16_t> OP##_u8(uint8x16_t a, uint8x16_t b) noexcept { return ::OP##_u8(a, b); } \ |
30 | | - inline RT<int8x16_t> OP##_s8(int8x16_t a, int8x16_t b) noexcept { return ::OP##_s8(a, b); } \ |
31 | | - inline RT<uint16x8_t> OP##_u16(uint16x8_t a, uint16x8_t b) noexcept { return ::OP##_u16(a, b); } \ |
32 | | - inline RT<int16x8_t> OP##_s16(int16x8_t a, int16x8_t b) noexcept { return ::OP##_s16(a, b); } \ |
33 | | - inline RT<uint32x4_t> OP##_u32(uint32x4_t a, uint32x4_t b) noexcept { return ::OP##_u32(a, b); } \ |
34 | | - inline RT<int32x4_t> OP##_s32(int32x4_t a, int32x4_t b) noexcept { return ::OP##_s32(a, b); } \ |
| 26 | +#define WRAP_BINARY_INT_EXCLUDING_64(OP, RT) \ |
| 27 | + namespace wrap \ |
| 28 | + { \ |
| 29 | + inline RT<uint8x16_t> OP##_u8(uint8x16_t a, uint8x16_t b) noexcept \ |
| 30 | + { \ |
| 31 | + return ::OP##_u8(a, b); \ |
| 32 | + } \ |
| 33 | + inline RT<int8x16_t> OP##_s8(int8x16_t a, int8x16_t b) noexcept \ |
| 34 | + { \ |
| 35 | + return ::OP##_s8(a, b); \ |
| 36 | + } \ |
| 37 | + inline RT<uint16x8_t> OP##_u16(uint16x8_t a, uint16x8_t b) noexcept \ |
| 38 | + { \ |
| 39 | + return ::OP##_u16(a, b); \ |
| 40 | + } \ |
| 41 | + inline RT<int16x8_t> OP##_s16(int16x8_t a, int16x8_t b) noexcept \ |
| 42 | + { \ |
| 43 | + return ::OP##_s16(a, b); \ |
| 44 | + } \ |
| 45 | + inline RT<uint32x4_t> OP##_u32(uint32x4_t a, uint32x4_t b) noexcept \ |
| 46 | + { \ |
| 47 | + return ::OP##_u32(a, b); \ |
| 48 | + } \ |
| 49 | + inline RT<int32x4_t> OP##_s32(int32x4_t a, int32x4_t b) noexcept \ |
| 50 | + { \ |
| 51 | + return ::OP##_s32(a, b); \ |
| 52 | + } \ |
35 | 53 | } |
36 | 54 |
|
37 | | -#define WRAP_BINARY_INT(OP, RT) \ |
38 | | - WRAP_BINARY_INT_EXCLUDING_64(OP, RT) \ |
39 | | - namespace wrap \ |
40 | | - { \ |
41 | | - inline RT<uint64x2_t> OP##_u64(uint64x2_t a, uint64x2_t b) noexcept { return ::OP##_u64(a, b); } \ |
42 | | - inline RT<int64x2_t> OP##_s64(int64x2_t a, int64x2_t b) noexcept { return ::OP##_s64(a, b); } \ |
| 55 | +#define WRAP_BINARY_INT(OP, RT) \ |
| 56 | + WRAP_BINARY_INT_EXCLUDING_64(OP, RT) \ |
| 57 | + namespace wrap \ |
| 58 | + { \ |
| 59 | + inline RT<uint64x2_t> OP##_u64(uint64x2_t a, uint64x2_t b) noexcept \ |
| 60 | + { \ |
| 61 | + return ::OP##_u64(a, b); \ |
| 62 | + } \ |
| 63 | + inline RT<int64x2_t> OP##_s64(int64x2_t a, int64x2_t b) noexcept \ |
| 64 | + { \ |
| 65 | + return ::OP##_s64(a, b); \ |
| 66 | + } \ |
43 | 67 | } |
44 | 68 |
|
45 | | -#define WRAP_BINARY_FLOAT(OP, RT) \ |
46 | | - namespace wrap \ |
47 | | - { \ |
48 | | - inline RT<float32x4_t> OP##_f32(float32x4_t a, float32x4_t b) noexcept { return ::OP##_f32(a, b); } \ |
| 69 | +#define WRAP_BINARY_FLOAT(OP, RT) \ |
| 70 | + namespace wrap \ |
| 71 | + { \ |
| 72 | + inline RT<float32x4_t> OP##_f32(float32x4_t a, float32x4_t b) noexcept \ |
| 73 | + { \ |
| 74 | + return ::OP##_f32(a, b); \ |
| 75 | + } \ |
49 | 76 | } |
50 | 77 |
|
51 | | -#define WRAP_UNARY_INT_EXCLUDING_64(OP) \ |
52 | | - namespace wrap \ |
53 | | - { \ |
54 | | - inline uint8x16_t OP##_u8(uint8x16_t a) noexcept { return ::OP##_u8(a); } \ |
55 | | - inline int8x16_t OP##_s8(int8x16_t a) noexcept { return ::OP##_s8(a); } \ |
56 | | - inline uint16x8_t OP##_u16(uint16x8_t a) noexcept { return ::OP##_u16(a); } \ |
57 | | - inline int16x8_t OP##_s16(int16x8_t a) noexcept { return ::OP##_s16(a); } \ |
58 | | - inline uint32x4_t OP##_u32(uint32x4_t a) noexcept { return ::OP##_u32(a); } \ |
59 | | - inline int32x4_t OP##_s32(int32x4_t a) noexcept { return ::OP##_s32(a); } \ |
| 78 | +#define WRAP_UNARY_INT_EXCLUDING_64(OP) \ |
| 79 | + namespace wrap \ |
| 80 | + { \ |
| 81 | + inline uint8x16_t OP##_u8(uint8x16_t a) noexcept \ |
| 82 | + { \ |
| 83 | + return ::OP##_u8(a); \ |
| 84 | + } \ |
| 85 | + inline int8x16_t OP##_s8(int8x16_t a) noexcept \ |
| 86 | + { \ |
| 87 | + return ::OP##_s8(a); \ |
| 88 | + } \ |
| 89 | + inline uint16x8_t OP##_u16(uint16x8_t a) noexcept \ |
| 90 | + { \ |
| 91 | + return ::OP##_u16(a); \ |
| 92 | + } \ |
| 93 | + inline int16x8_t OP##_s16(int16x8_t a) noexcept \ |
| 94 | + { \ |
| 95 | + return ::OP##_s16(a); \ |
| 96 | + } \ |
| 97 | + inline uint32x4_t OP##_u32(uint32x4_t a) noexcept \ |
| 98 | + { \ |
| 99 | + return ::OP##_u32(a); \ |
| 100 | + } \ |
| 101 | + inline int32x4_t OP##_s32(int32x4_t a) noexcept \ |
| 102 | + { \ |
| 103 | + return ::OP##_s32(a); \ |
| 104 | + } \ |
60 | 105 | } |
61 | 106 |
|
62 | | -#define WRAP_UNARY_INT(OP) \ |
63 | | - WRAP_UNARY_INT_EXCLUDING_64(OP) \ |
64 | | - namespace wrap \ |
65 | | - { \ |
66 | | - inline uint64x2_t OP##_u64(uint64x2_t a) noexcept { return ::OP##_u64(a); } \ |
67 | | - inline int64x2_t OP##_s64(int64x2_t a) noexcept { return ::OP##_s64(a); } \ |
| 107 | +#define WRAP_UNARY_INT(OP) \ |
| 108 | + WRAP_UNARY_INT_EXCLUDING_64(OP) \ |
| 109 | + namespace wrap \ |
| 110 | + { \ |
| 111 | + inline uint64x2_t OP##_u64(uint64x2_t a) noexcept \ |
| 112 | + { \ |
| 113 | + return ::OP##_u64(a); \ |
| 114 | + } \ |
| 115 | + inline int64x2_t OP##_s64(int64x2_t a) noexcept \ |
| 116 | + { \ |
| 117 | + return ::OP##_s64(a); \ |
| 118 | + } \ |
68 | 119 | } |
69 | 120 |
|
70 | | -#define WRAP_UNARY_FLOAT(OP) \ |
71 | | - namespace wrap \ |
72 | | - { \ |
73 | | - inline float32x4_t OP##_f32(float32x4_t a) noexcept { return ::OP##_f32(a); } \ |
| 121 | +#define WRAP_UNARY_FLOAT(OP) \ |
| 122 | + namespace wrap \ |
| 123 | + { \ |
| 124 | + inline float32x4_t OP##_f32(float32x4_t a) noexcept \ |
| 125 | + { \ |
| 126 | + return ::OP##_f32(a); \ |
| 127 | + } \ |
74 | 128 | } |
75 | 129 |
|
76 | 130 | // Dummy identity caster to ease coding |
@@ -601,13 +655,13 @@ namespace xsimd |
601 | 655 | template <class A, class T, detail::enable_sized_unsigned_t<T, 8> = 0> |
602 | 656 | inline batch<T, A> neg(batch<T, A> const& rhs, requires_arch<neon>) noexcept |
603 | 657 | { |
604 | | - return batch<T, A>({ -rhs.get(0), -rhs.get(1) }); |
| 658 | + return batch<T, A> { -rhs.get(0), -rhs.get(1) }; |
605 | 659 | } |
606 | 660 |
|
607 | 661 | template <class A, class T, detail::enable_sized_signed_t<T, 8> = 0> |
608 | 662 | inline batch<T, A> neg(batch<T, A> const& rhs, requires_arch<neon>) noexcept |
609 | 663 | { |
610 | | - return batch<T, A>({ -rhs.get(0), -rhs.get(1) }); |
| 664 | + return batch<T, A> { -rhs.get(0), -rhs.get(1) }; |
611 | 665 | } |
612 | 666 |
|
613 | 667 | template <class A> |
@@ -2280,18 +2334,45 @@ namespace xsimd |
2280 | 2334 | * bitwise_cast * |
2281 | 2335 | ****************/ |
2282 | 2336 |
|
2283 | | -#define WRAP_CAST(SUFFIX, TYPE) \ |
2284 | | - namespace wrap \ |
2285 | | - { \ |
2286 | | - inline TYPE vreinterpretq_##SUFFIX##_u8(uint8x16_t a) noexcept { return ::vreinterpretq_##SUFFIX##_u8(a); } \ |
2287 | | - inline TYPE vreinterpretq_##SUFFIX##_s8(int8x16_t a) noexcept { return ::vreinterpretq_##SUFFIX##_s8(a); } \ |
2288 | | - inline TYPE vreinterpretq_##SUFFIX##_u16(uint16x8_t a) noexcept { return ::vreinterpretq_##SUFFIX##_u16(a); } \ |
2289 | | - inline TYPE vreinterpretq_##SUFFIX##_s16(int16x8_t a) noexcept { return ::vreinterpretq_##SUFFIX##_s16(a); } \ |
2290 | | - inline TYPE vreinterpretq_##SUFFIX##_u32(uint32x4_t a) noexcept { return ::vreinterpretq_##SUFFIX##_u32(a); } \ |
2291 | | - inline TYPE vreinterpretq_##SUFFIX##_s32(int32x4_t a) noexcept { return ::vreinterpretq_##SUFFIX##_s32(a); } \ |
2292 | | - inline TYPE vreinterpretq_##SUFFIX##_u64(uint64x2_t a) noexcept { return ::vreinterpretq_##SUFFIX##_u64(a); } \ |
2293 | | - inline TYPE vreinterpretq_##SUFFIX##_s64(int64x2_t a) noexcept { return ::vreinterpretq_##SUFFIX##_s64(a); } \ |
2294 | | - inline TYPE vreinterpretq_##SUFFIX##_f32(float32x4_t a) noexcept { return ::vreinterpretq_##SUFFIX##_f32(a); } \ |
| 2337 | +#define WRAP_CAST(SUFFIX, TYPE) \ |
| 2338 | + namespace wrap \ |
| 2339 | + { \ |
| 2340 | + inline TYPE vreinterpretq_##SUFFIX##_u8(uint8x16_t a) noexcept \ |
| 2341 | + { \ |
| 2342 | + return ::vreinterpretq_##SUFFIX##_u8(a); \ |
| 2343 | + } \ |
| 2344 | + inline TYPE vreinterpretq_##SUFFIX##_s8(int8x16_t a) noexcept \ |
| 2345 | + { \ |
| 2346 | + return ::vreinterpretq_##SUFFIX##_s8(a); \ |
| 2347 | + } \ |
| 2348 | + inline TYPE vreinterpretq_##SUFFIX##_u16(uint16x8_t a) noexcept \ |
| 2349 | + { \ |
| 2350 | + return ::vreinterpretq_##SUFFIX##_u16(a); \ |
| 2351 | + } \ |
| 2352 | + inline TYPE vreinterpretq_##SUFFIX##_s16(int16x8_t a) noexcept \ |
| 2353 | + { \ |
| 2354 | + return ::vreinterpretq_##SUFFIX##_s16(a); \ |
| 2355 | + } \ |
| 2356 | + inline TYPE vreinterpretq_##SUFFIX##_u32(uint32x4_t a) noexcept \ |
| 2357 | + { \ |
| 2358 | + return ::vreinterpretq_##SUFFIX##_u32(a); \ |
| 2359 | + } \ |
| 2360 | + inline TYPE vreinterpretq_##SUFFIX##_s32(int32x4_t a) noexcept \ |
| 2361 | + { \ |
| 2362 | + return ::vreinterpretq_##SUFFIX##_s32(a); \ |
| 2363 | + } \ |
| 2364 | + inline TYPE vreinterpretq_##SUFFIX##_u64(uint64x2_t a) noexcept \ |
| 2365 | + { \ |
| 2366 | + return ::vreinterpretq_##SUFFIX##_u64(a); \ |
| 2367 | + } \ |
| 2368 | + inline TYPE vreinterpretq_##SUFFIX##_s64(int64x2_t a) noexcept \ |
| 2369 | + { \ |
| 2370 | + return ::vreinterpretq_##SUFFIX##_s64(a); \ |
| 2371 | + } \ |
| 2372 | + inline TYPE vreinterpretq_##SUFFIX##_f32(float32x4_t a) noexcept \ |
| 2373 | + { \ |
| 2374 | + return ::vreinterpretq_##SUFFIX##_f32(a); \ |
| 2375 | + } \ |
2295 | 2376 | } |
2296 | 2377 |
|
2297 | 2378 | WRAP_CAST(u8, uint8x16_t) |
|
0 commit comments