Skip to content

Commit ac4a1c8

Browse files
Fix RISCV build
1 parent 1b3e69d commit ac4a1c8

File tree

2 files changed

+40
-38
lines changed

2 files changed

+40
-38
lines changed

include/xsimd/arch/xsimd_rvv.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ namespace xsimd
513513
return __riscv_vset(tmp, 1, hi);
514514
}
515515

516-
template <class T, size_t W, std::enable_if_t<W<types::detail::rvv_width_m1, int>::type = 0> D_INLINE rvv_reg_t<T, W * 2> rvvabut(rvv_reg_t<T, W> const& lo, rvv_reg_t<T, W> const& hi) noexcept
516+
template <class T, size_t W, std::enable_if_t<W<types::detail::rvv_width_m1, int> = 0> XSIMD_INLINE rvv_reg_t<T, W * 2> rvvabut(rvv_reg_t<T, W> const& lo, rvv_reg_t<T, W> const& hi) noexcept
517517
{
518518
return __riscv_vslideup(lo, hi, lo.vl, lo.vl * 2);
519519
}
@@ -538,7 +538,7 @@ namespace xsimd
538538
typename rvv_reg_t<T, W>::register_type tmp = vv;
539539
return tmp;
540540
}
541-
template <class T, size_t W, std::enable_if_t<W<types::detail::rvv_width_m1, int>::type = 0> reg_t<T, W> rvvget_hi(rvv_reg_t<T, W * 2> const& vv) noexcept
541+
template <class T, size_t W, std::enable_if_t<W<types::detail::rvv_width_m1, int> = 0> rvv_reg_t<T, W> rvvget_hi(rvv_reg_t<T, W * 2> const& vv) noexcept
542542
{
543543
return __riscv_vslidedown(vv, vv.vl / 2, vv.vl);
544544
}

include/xsimd/types/xsimd_rvv_register.hpp

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -219,42 +219,24 @@ namespace xsimd
219219
type get() const { return value; }
220220
void set(type v) { value = v; }
221221
};
222-
//
223-
// But sometimes we want our storage type to be less than a whole
224-
// register, while presenting as a whole register to the outside
225-
// world. This is because some partial-register types are not
226-
// defined, but they can (mostly) be emulated using shorter vl on a
227-
// full-width register for arithmetic, and cast back to a partial
228-
// byte register for storage.
229-
//
230-
template <class T, size_t divisor>
231-
struct rvv_semiblob : public rvv_type_info<T, rvv_width_m1>
232-
{
233-
using super = rvv_type_info<T, rvv_width_m1>;
234-
static constexpr size_t width = rvv_width_m1 / divisor;
235-
using typename super::type;
236-
template <size_t div>
237-
struct semitype;
238-
template <>
239-
struct semitype<2>
240-
{
241-
using type = vuint8mf2_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF2)));
242-
};
243-
template <>
244-
struct semitype<4>
245-
{
246-
using type = vuint8mf4_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF4)));
247-
};
248-
template <>
249-
struct semitype<8>
250-
{
251-
using type = vuint8mf8_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF8)));
252-
};
253-
using fixed_type = typename semitype<divisor>::type;
254-
using super::as_bytes;
255-
using super::bitcast;
256222

257-
fixed_type value;
223+
template <size_t div>
224+
struct semitype;
225+
template <>
226+
struct semitype<2>
227+
{
228+
using type = vuint8mf2_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF2)));
229+
};
230+
template <>
231+
struct semitype<4>
232+
{
233+
using type = vuint8mf4_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF4)));
234+
};
235+
template <>
236+
struct semitype<8>
237+
{
238+
using type = vuint8mf8_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF8)));
239+
};
258240
template <size_t div>
259241
vuint8m1_t get_bytes() const;
260242
template <>
@@ -281,7 +263,27 @@ namespace xsimd
281263
vuint8m1_t bytes = as_bytes(v);
282264
set_bytes<divisor>(bytes);
283265
}
284-
};
266+
267+
//
268+
// But sometimes we want our storage type to be less than a whole
269+
// register, while presenting as a whole register to the outside
270+
// world. This is because some partial-register types are not
271+
// defined, but they can (mostly) be emulated using shorter vl on a
272+
// full-width register for arithmetic, and cast back to a partial
273+
// byte register for storage.
274+
//
275+
template <class T, size_t divisor>
276+
struct rvv_semiblob : public rvv_type_info<T, rvv_width_m1>
277+
{
278+
using super = rvv_type_info<T, rvv_width_m1>;
279+
static constexpr size_t width = rvv_width_m1 / divisor;
280+
using typename super::type;
281+
using fixed_type = typename semitype<divisor>::type;
282+
using super::as_bytes;
283+
using super::bitcast;
284+
285+
fixed_type value;
286+
};
285287
template <class T>
286288
struct rvv_blob<T, rvv_width_mf2> : rvv_semiblob<T, 2>
287289
{

0 commit comments

Comments
 (0)