To make it possible for template code and code receiving typedef versions of vector types to change what they need to change without getting entagled with the rest of the data type.
Also:
vuint8mf4_t __riscv_vlmul_widen(vuint8mf8_t v) { return __riscv_vlmul_ext_u8mf4(v); }
vuint8mf2_t __riscv_vlmul_widen(vuint8mf4_t); /* ... */
vuint8m1_t __riscv_vlmul_widen(vuint8mf2_t);
vuint8m2_t __riscv_vlmul_widen(vuint8m1_t);
vuint8m4_t __riscv_vlmul_widen(vuint8m2_t);
vuint8m8_t __riscv_vlmul_widen(vuint8m4_t);
// etc., across all element types
vuint8mf8_t __riscv_vlmul_narrow(vuint8mf4_t v) { return __riscv_vlmul_trunc_u8mf8(v); }
vuint8mf4_t __riscv_vlmul_narrow(vuint8mf2_t); /* ... */
vuint8mf2_t __riscv_vlmul_narrow(vuint8m1_t);
vuint8m1_t __riscv_vlmul_narrow(vuint8m2_t);
vuint8m2_t __riscv_vlmul_narrow(vuint8m4_t);
vuint8m4_t __riscv_vlmul_narrow(vuint8m8_t);
// etc., across all element types
#if 1 // debatable
vuint8mf8_t __riscv_vget_upper(vuint8mf4_t v ) { return __riscv_vslidedown(v, __riscv_vsetvlmax_e8mf8(), __riscv_vsetvlmax_e8mf8()); }
vuint8mf4_t __riscv_vget_upper(vuint8mf2_t); /* ... */
vuint8mf2_t __riscv_vget_upper(vuint8m1_t);
#endif
vuint8m1_t __riscv_vget_upper(vuint8m2_t v) { return __riscv_vget_u8m1(v, 1); }
vuint8m2_t __riscv_vget_upper(vuint8m4_t); /* ... */
vuint8m4_t __riscv_vget_upper(vuint8m8_t);
// etc., across all element types
#define __riscv_vset_upper(d, v) __riscv_vset(d, 1, v) /* shouldn't accept some variants, but whatever */
#define __riscv_vget_lower __riscv_vlmul_narrow /* same operation, but with a consistent name based on intent */
#define __riscv_vjoin(a, b) __riscv_vset_upper(__riscv_vlmul_widen(a), b)
Allowing code to cope with the relative widening and narrowing of data types by factors of two under the same conditions as above.
I guess there's also the element-wise widen (a form of vreinterpret), and the vlmul widen with element-wise widen at the same time; though you can cobble the latter together with the other two.
Consider overloads like:
To make it possible for template code and code receiving
typedef
versions of vector types to change what they need to change without getting entagled with the rest of the data type.Also:
Allowing code to cope with the relative widening and narrowing of data types by factors of two under the same conditions as above.