diff --git a/.github/workflows/cross-rvv.yml b/.github/workflows/cross-rvv.yml index f740599bd..e7274627c 100644 --- a/.github/workflows/cross-rvv.yml +++ b/.github/workflows/cross-rvv.yml @@ -1,7 +1,7 @@ name: RISC-V RVV cross-compilation build on: [push, pull_request] concurrency: - group: ${{ github.workflow }}-${{ matrix.sys.compiler }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} cancel-in-progress: true jobs: build: diff --git a/include/xsimd/arch/xsimd_rvv.hpp b/include/xsimd/arch/xsimd_rvv.hpp index c659c14e4..5d2fdef03 100644 --- a/include/xsimd/arch/xsimd_rvv.hpp +++ b/include/xsimd/arch/xsimd_rvv.hpp @@ -513,7 +513,7 @@ namespace xsimd return __riscv_vset(tmp, 1, hi); } - template ::type = 0> D_INLINE rvv_reg_t rvvabut(rvv_reg_t const& lo, rvv_reg_t const& hi) noexcept + template = 0> XSIMD_INLINE rvv_reg_t rvvabut(rvv_reg_t const& lo, rvv_reg_t const& hi) noexcept { return __riscv_vslideup(lo, hi, lo.vl, lo.vl * 2); } @@ -538,7 +538,7 @@ namespace xsimd typename rvv_reg_t::register_type tmp = vv; return tmp; } - template ::type = 0> reg_t rvvget_hi(rvv_reg_t const& vv) noexcept + template = 0> rvv_reg_t rvvget_hi(rvv_reg_t const& vv) noexcept { return __riscv_vslidedown(vv, vv.vl / 2, vv.vl); } diff --git a/include/xsimd/types/xsimd_rvv_register.hpp b/include/xsimd/types/xsimd_rvv_register.hpp index e56cb5261..8ebeda48f 100644 --- a/include/xsimd/types/xsimd_rvv_register.hpp +++ b/include/xsimd/types/xsimd_rvv_register.hpp @@ -219,6 +219,25 @@ namespace xsimd type get() const { return value; } void set(type v) { value = v; } }; + + template + struct semitype; + template <> + struct semitype<2> + { + using type = vuint8mf2_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF2))); + }; + template <> + struct semitype<4> + { + using type = vuint8mf4_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF4))); + }; + template <> + struct semitype<8> + { + using type = vuint8mf8_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF8))); + }; + // // But sometimes we want our storage type to be less than a whole // register, while presenting as a whole register to the outside @@ -233,53 +252,26 @@ namespace xsimd using super = rvv_type_info; static constexpr size_t width = rvv_width_m1 / divisor; using typename super::type; - template - struct semitype; - template <> - struct semitype<2> - { - using type = vuint8mf2_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF2))); - }; - template <> - struct semitype<4> - { - using type = vuint8mf4_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF4))); - }; - template <> - struct semitype<8> - { - using type = vuint8mf8_t __attribute__((riscv_rvv_vector_bits(XSIMD_RVV_WIDTH_MF8))); - }; using fixed_type = typename semitype::type; using super::as_bytes; using super::bitcast; fixed_type value; - template - vuint8m1_t get_bytes() const; - template <> - vuint8m1_t get_bytes<2>() const { return __riscv_vlmul_ext_v_u8mf2_u8m1(value); } - template <> - vuint8m1_t get_bytes<4>() const { return __riscv_vlmul_ext_v_u8mf4_u8m1(value); } - template <> - vuint8m1_t get_bytes<8>() const { return __riscv_vlmul_ext_v_u8mf8_u8m1(value); } + vuint8m1_t get_bytes(std::integral_constant) const { return __riscv_vlmul_ext_v_u8mf2_u8m1(value); } + vuint8m1_t get_bytes(std::integral_constant) const { return __riscv_vlmul_ext_v_u8mf4_u8m1(value); } + vuint8m1_t get_bytes(std::integral_constant) const { return __riscv_vlmul_ext_v_u8mf8_u8m1(value); } type get() const noexcept { - vuint8m1_t bytes = get_bytes(); + vuint8m1_t bytes = get_bytes(std::integral_constant()); return bitcast(bytes); } - template - void set_bytes(vuint8m1_t); - template <> - void set_bytes<2>(vuint8m1_t v) { value = __riscv_vlmul_trunc_v_u8m1_u8mf2(v); } - template <> - void set_bytes<4>(vuint8m1_t v) { value = __riscv_vlmul_trunc_v_u8m1_u8mf4(v); } - template <> - void set_bytes<8>(vuint8m1_t v) { value = __riscv_vlmul_trunc_v_u8m1_u8mf8(v); } + void set_bytes(vuint8m1_t v, std::integral_constant) { value = __riscv_vlmul_trunc_v_u8m1_u8mf2(v); } + void set_bytes(vuint8m1_t v, std::integral_constant) { value = __riscv_vlmul_trunc_v_u8m1_u8mf4(v); } + void set_bytes(vuint8m1_t v, std::integral_constant) { value = __riscv_vlmul_trunc_v_u8m1_u8mf8(v); } void set(type v) { vuint8m1_t bytes = as_bytes(v); - set_bytes(bytes); + set_bytes(bytes, std::integral_constant()); } }; template