riscv-non-isa / rvv-intrinsic-doc

https://jira.riscv.org/browse/RVG-153
BSD 3-Clause "New" or "Revised" License
281 stars 89 forks source link

Add vcreate intrinsics for creating tuple type values #256

Closed eopXD closed 1 year ago

eopXD commented 1 year ago

Note: This is currently based upon #257

Although this is does not add more functionality and is a syntax sugar, with vcreate we can have less verbose code when the code involves tuple types.

Without vcreate

void foo(vint32m1_t v0, vint32m1_t v1) {
  vint32m1x2_t tuple;

  tuple = __riscv_vset_v_i32m1_i32m1x2(tuple, 0, v0);
  tuple = __riscv_vset_v_i32m1_i32m1x2(tuple, 1, v1);
}

With vcreate:

void foo(vint32m1_t v0, vint32m1_t v1) {
  vint32m1x2_t tuple;

  tuple = __vcreate_v_i32m1x2(v0, v1);
}

The LLVM implementation is https://reviews.llvm.org/D158402

eopXD commented 1 year ago

Force-push change: Rebase and produce upon latest main.