1616#include " ../config/xsimd_macros.hpp"
1717#include " ../types/xsimd_batch_constant.hpp"
1818#include " ../types/xsimd_rvv_register.hpp"
19+ #include " ../utils/xsimd_type_traits.hpp"
1920#include " ./xsimd_constants.hpp"
2021
2122// This set of macros allows the synthesis of identifiers using a template and
8687// for the function signature argument(s) to XSIMD_RVV_OVERLOAD. That signature can
8788// also reference the template argument T, because it's a text substitution
8889// into the template.
89- #define XSIMD_RVV_WRAPPER_HEAD (NAME, SIGNATURE, ...) \
90- namespace NAME ##_cruft \
91- { \
92- template <class T > \
93- struct ctx \
94- { \
95- static constexpr size_t width = XSIMD_RVV_BITS; \
96- static constexpr size_t vl = width / (sizeof (T) * 8 ); \
97- using vec = rvv_reg_t <T, width>; \
98- using uvec = rvv_reg_t <as_unsigned_relaxed_t <T >, width>; \
99- using svec = rvv_reg_t <as_signed_relaxed_t <T >, width>; \
100- using fvec = rvv_reg_t <as_float_relaxed_t <T>, width>; \
101- using bvec = rvv_bool_t <T, width>; \
102- using scalar_vec = rvv_reg_t <T, types::detail::rvv_width_m1>; \
103- using wide_vec = rvv_reg_t <T, width * 2 >; \
104- using narrow_vec = rvv_reg_t <T, width / 2 >; \
105- using type = SIGNATURE; \
106- }; \
107- template <class T > \
108- using sig_t = typename ctx<T>::type; \
109- template <class K , class T > \
110- struct impl \
111- { \
112- void operator ()() const noexcept {}; \
113- }; \
114- template <class K > \
90+ #define XSIMD_RVV_WRAPPER_HEAD (NAME, SIGNATURE, ...) \
91+ namespace NAME ##_cruft \
92+ { \
93+ template <class T > \
94+ struct ctx \
95+ { \
96+ static constexpr size_t width = XSIMD_RVV_BITS; \
97+ static constexpr size_t vl = width / (sizeof (T) * 8 ); \
98+ using vec = rvv_reg_t <T, width>; \
99+ using uvec = rvv_reg_t <xsimd:: sized_uint_t < sizeof (T) >, width>; \
100+ using svec = rvv_reg_t <xsimd:: sized_int_t < sizeof (T) >, width>; \
101+ using fvec = rvv_reg_t <as_float_relaxed_t <T>, width>; \
102+ using bvec = rvv_bool_t <T, width>; \
103+ using scalar_vec = rvv_reg_t <T, types::detail::rvv_width_m1>; \
104+ using wide_vec = rvv_reg_t <T, width * 2 >; \
105+ using narrow_vec = rvv_reg_t <T, width / 2 >; \
106+ using type = SIGNATURE; \
107+ }; \
108+ template <class T > \
109+ using sig_t = typename ctx<T>::type; \
110+ template <class K , class T > \
111+ struct impl \
112+ { \
113+ void operator ()() const noexcept {}; \
114+ }; \
115+ template <class K > \
115116 using impl_t = impl<K, sig_t <K>>;
116117
117118#define XSIMD_RVV_WRAPPER_HEAD_NOVL (...) XSIMD_RVV_WRAPPER_HEAD(__VA_ARGS__)
@@ -294,57 +295,12 @@ namespace xsimd
294295 template <class T , size_t Width = XSIMD_RVV_BITS>
295296 using rvv_bool_t = types::detail::rvv_bool_t <T, Width>;
296297
297- template <size_t >
298- struct as_signed_relaxed ;
299- template <>
300- struct as_signed_relaxed <1 >
301- {
302- using type = int8_t ;
303- };
304- template <>
305- struct as_signed_relaxed <2 >
306- {
307- using type = int16_t ;
308- };
309- template <>
310- struct as_signed_relaxed <4 >
311- {
312- using type = int32_t ;
313- };
314- template <>
315- struct as_signed_relaxed <8 >
316- {
317- using type = int64_t ;
318- };
319- template <class T >
320- using as_signed_relaxed_t = typename as_signed_relaxed<sizeof (T)>::type;
321- template <size_t >
322- struct as_unsigned_relaxed ;
323- template <>
324- struct as_unsigned_relaxed <1 >
298+ template <std::size_t S>
299+ struct as_float_relaxed
325300 {
326- using type = uint8_t ;
301+ using type = xsimd:: sized_fp_t <S> ;
327302 };
328303 template <>
329- struct as_unsigned_relaxed <2 >
330- {
331- using type = uint16_t ;
332- };
333- template <>
334- struct as_unsigned_relaxed <4 >
335- {
336- using type = uint32_t ;
337- };
338- template <>
339- struct as_unsigned_relaxed <8 >
340- {
341- using type = uint64_t ;
342- };
343- template <class T >
344- using as_unsigned_relaxed_t = typename as_unsigned_relaxed<sizeof (T)>::type;
345- template <size_t >
346- struct as_float_relaxed ;
347- template <>
348304 struct as_float_relaxed <1 >
349305 {
350306 using type = int8_t ;
@@ -354,16 +310,6 @@ namespace xsimd
354310 {
355311 using type = int16_t ;
356312 };
357- template <>
358- struct as_float_relaxed <4 >
359- {
360- using type = float ;
361- };
362- template <>
363- struct as_float_relaxed <8 >
364- {
365- using type = double ;
366- };
367313 template <class T >
368314 using as_float_relaxed_t = typename as_float_relaxed<sizeof (T)>::type;
369315
0 commit comments