Normal view

There are new articles available, click to refresh the page.
Before yesterdayRecent Questions - Stack Overflow

LLVM: Builtin DEF corresponding to RVV vector

I have a question regarding how to build a builtin type for my custom instruction. The instruction itself has a VR (RISCV vector register) type parameter. The corresponding intrinsic type is llvm_anyvector_ty. However I could not search any type to define it in TARGET_BUILTIN.

For example, in BuiltinsRISCV.def, we could find something like:

TARGET_BUILTIN(__builtin_riscv_sgcfgsatu, "vUWi", "nc", "xsgmat,64bit")

It defines return type as void and the only paramter as unsigned long. But what key word corresponds to the parameter types of RVV, like __rvv_float32m1_t?

PS: it seems RVVBuiltin provides the parsing method, but would it be possible to define them without assistance from RVVBuiltin?

Thanks!

I tried to use "V16f" as the keyword string, like

TARGET_BUILTIN(__builtin_riscv_sgmovtv, "vV4fUWi", "nc", "xsgmat,64bit")

but while compiling the following code, LLVM reports: test.c:47:29: error: passing '__rvv_float32m1_t' to parameter of incompatible type 'attribute((vector_size(16 * sizeof(float)))) float' (vector of 16 'float' values)

__rvv_float32m1_t vec_a = __riscv_vle32_v_f32m1(ptr_a, vl);
__builtin_riscv_sgmovtv(vec_a, 0xFFA);
❌
❌