@@ -62,9 +62,12 @@ namespace xsimd
6262 static constexpr size_t rvv_width_mf4 = XSIMD_RVV_BITS / 4 ;
6363 static constexpr size_t rvv_width_mf2 = XSIMD_RVV_BITS / 2 ;
6464 static constexpr size_t rvv_width_m1 = XSIMD_RVV_BITS;
65- static constexpr size_t rvv_width_m2 = XSIMD_RVV_BITS * 2 ;
66- static constexpr size_t rvv_width_m4 = XSIMD_RVV_BITS * 4 ;
67- static constexpr size_t rvv_width_m8 = XSIMD_RVV_BITS * 8 ;
65+
66+ // Cope with gcc limitation, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116484
67+ #define XSIMD_RVV_WIDTH_MF8 (XSIMD_RVV_BITS / 8 )
68+ #define XSIMD_RVV_WIDTH_MF4 (XSIMD_RVV_BITS / 4 )
69+ #define XSIMD_RVV_WIDTH_MF2 (XSIMD_RVV_BITS / 2 )
70+ #define XSIMD_RVV_WIDTH_M1 XSIMD_RVV_BITS
6871
6972 // rvv_type_info is a utility class to convert scalar type and
7073 // bitwidth into rvv register types.
@@ -86,7 +89,7 @@ namespace xsimd
8689 static constexpr size_t width = rvv_width_m1 * vmul; \
8790 using type = XSIMD_RVV_TYPE(t, s, vmul); \
8891 using byte_type = XSIMD_RVV_TYPE(u, 8 , vmul); \
89- using fixed_type = type __attribute__ ((riscv_rvv_vector_bits(width))); \
92+ using fixed_type = type __attribute__ ((riscv_rvv_vector_bits(/* width= */ XSIMD_RVV_WIDTH_M1 * vmul ))); \
9093 template <class U > \
9194 static XSIMD_INLINE type bitcast (U x) noexcept \
9295 { \
@@ -235,17 +238,17 @@ namespace xsimd
235238 template <>
236239 struct semitype <2 >
237240 {
238- using type = vuint8mf2_t __attribute__ ((riscv_rvv_vector_bits(rvv_width_mf2 )));
241+ using type = vuint8mf2_t __attribute__ ((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF2 )));
239242 };
240243 template <>
241244 struct semitype <4 >
242245 {
243- using type = vuint8mf4_t __attribute__ ((riscv_rvv_vector_bits(rvv_width_mf4 )));
246+ using type = vuint8mf4_t __attribute__ ((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF4 )));
244247 };
245248 template <>
246249 struct semitype <8 >
247250 {
248- using type = vuint8mf8_t __attribute__ ((riscv_rvv_vector_bits(rvv_width_mf8 )));
251+ using type = vuint8mf8_t __attribute__ ((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF8 )));
249252 };
250253 using fixed_type = typename semitype<divisor>::type;
251254 using super::as_bytes;
@@ -374,7 +377,7 @@ namespace xsimd
374377 struct rvv_bool
375378 {
376379 using bool_info = rvv_bool_info<rvv_width_m1 * sizeof (T) * 8 / Width>;
377- using storage_type = vuint8m1_t __attribute__ ((riscv_rvv_vector_bits(rvv_width_m1 )));
380+ using storage_type = vuint8m1_t __attribute__ ((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_M1 )));
378381 using type = typename bool_info::type;
379382 storage_type value;
380383 rvv_bool () = default ;
@@ -489,6 +492,12 @@ namespace xsimd
489492 using type = detail::rvv_bool_simd_register<T>;
490493 };
491494 } // namespace types
495+
496+ #undef XSIMD_RVV_WIDTH_MF8
497+ #undef XSIMD_RVV_WIDTH_MF4
498+ #undef XSIMD_RVV_WIDTH_MF2
499+ #undef XSIMD_RVV_WIDTH_M1
500+
492501#else
493502 using rvv = detail::rvv<0xFFFFFFFF >;
494503#endif
0 commit comments