This commit adds function vlenb into riscv_vector.h. vlenb is defined
through builtin function __builtin_rvv_vlenb, which is lowered to
llvm.read_register.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Basic/riscv_vector.td | ||
---|---|---|
1559 | Should we report errors if vwrite_csr(RVV_VLENB, some_value)? |
Upon a second thought, with future extensions of the intrinsics, we will add rounding mode and exception intrinsics. The exposure of vxsat, vxrm, and vcsr in vread_csr and vwrite_csr will confuse user and we should remove them. Furthermore, vstart is pretty much always kept to zero, and intrinsic users probably should not have access to them.
With the considerations above, I think vread_csr and vwrite_csr can be removed in the future when the rounding mode and exception intrinsics are added. This is why this patch is opening up a separate function to provide access to vlenb and not choose to extend another member in the enum.
clang/include/clang/Basic/riscv_vector.td | ||
---|---|---|
1559 | Thanks pointing this out. I think my second approach here won't create such problem. |
clang/include/clang/Basic/riscv_vector.td | ||
---|---|---|
1569 | Thank you for the tip. Please review. |
The code is OK to me, except a few small comments.
clang/include/clang/Basic/riscv_vector.td | ||
---|---|---|
1583 | The value type of read_register is i32 in llvm/test/CodeGen/RISCV/vlenb.ll, but I don't insist on it. | |
clang/test/CodeGen/RISCV/rvv-intrinsics/vlenb.c | ||
1 ↗ | (On Diff #487206) | Add --check-globals or --global-value-regex to check if the metadata is vlenb exactly? |
clang/include/clang/Basic/riscv_vector.td | ||
---|---|---|
1583 | So what about i32 for rv32 and i64 for rv64? |
clang/test/CodeGen/RISCV/rvv-intrinsics/vlenb.c | ||
---|---|---|
33 ↗ | (On Diff #487293) | Hmm, why would we emit version info here? I think we should avoid this. |
Update code: Avoid emit clang version in test case.
@pcwang-thead Thank you for checking and providing the corresponding resolution. :)
Should we report errors if vwrite_csr(RVV_VLENB, some_value)?