RISCV: Add vector psabi checking.#376
RISCV: Add vector psabi checking.#376yanzhang-dev wants to merge 7 commits intoriscvarchive:rvv-submission-v1from
Conversation
This patch adds support to check function's argument or return is vector type and throw warning if yes. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_vector_psabi_warnning): (riscv_arg_has_vector): (riscv_pass_in_vector_p): (riscv_get_arg_info): gcc/testsuite/ChangeLog: * gcc.target/riscv/vector-abi-1.c: New test. * gcc.target/riscv/vector-abi-2.c: New test. * gcc.target/riscv/vector-abi-3.c: New test. * gcc.target/riscv/vector-abi-4.c: New test. * gcc.target/riscv/vector-abi-5.c: New test. Signed-off-by: Yanzhang Wang <yanzhang.wang@intel.com> Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
bc09437 to
2c68135
Compare
|
Not familiar with ABI. I think it's all kito's call :) |
gcc/config/riscv/riscv.cc
Outdated
| if (type && riscv_arg_has_vector (type) && !warned) | ||
| { | ||
| warning (OPT_Wpsabi, "ABI for the vector type is currently in experimental" | ||
| "stage and may changes in the upcoming version of GCC."); |
There was a problem hiding this comment.
will the message become something like in experimentalstage and ... instead of in experimental stage and ... after joining?
There was a problem hiding this comment.
Yes. You're right. Will modify it in the fix commit.
There was a problem hiding this comment.
Cool, thank you!
gcc/config/riscv/riscv.cc
Outdated
| intrinsic vector type. Because we can't get the decl for the params. */ | ||
|
|
||
| static bool | ||
| riscv_arg_has_vector_size_attribute (const_tree type) |
There was a problem hiding this comment.
riscv_scalable_vector_type_p
gcc/config/riscv/riscv.cc
Outdated
| if (!TYPE_P (TREE_TYPE (f))) | ||
| break; | ||
|
|
||
| /* If there's vector_size attribute, ignore it. */ |
There was a problem hiding this comment.
Ignore it if it's fixed length vector.
gcc/config/riscv/riscv.cc
Outdated
|
|
||
| /* If there's vector_size attribute, ignore it. */ | ||
| if (VECTOR_TYPE_P (TREE_TYPE (f))) | ||
| is_vector = !riscv_arg_has_vector_size_attribute (type); |
There was a problem hiding this comment.
riscv_arg_has_vector_size_attribute (TREE_TYPE (f))?
There was a problem hiding this comment.
Thanks, you're right. It should be the field type.
gcc/config/riscv/riscv.cc
Outdated
| tree size = TYPE_SIZE (type); | ||
| if (size && TREE_CODE (size) == INTEGER_CST) | ||
| return true; | ||
|
|
||
| /* For the data type like vint32m1_t, the size code is POLY_INT_CST. */ | ||
| return false; |
There was a problem hiding this comment.
The return value should be inverted after function rename :)
There was a problem hiding this comment.
Oh understand. Could I know why the intrinsic vector type is named as scalable vector ?
There was a problem hiding this comment.
that's the term defined in AArch64 SVE actually, and we follow to use that term in our backend too , e.g. riscv.cc:riscv_v_adjust_scalable_frame
gcc/config/riscv/riscv.cc
Outdated
|
|
||
| if (type && riscv_arg_has_vector (type) && !warned) | ||
| { | ||
| warning (OPT_Wpsabi, "ABI for the vector type is currently in " |
There was a problem hiding this comment.
vector -> scalable vector, that should more clear that it's exclude fixed length vector.
|
Hi @kito-cheng , The commit 51fbc2e tries to fix the warning on intrinsic APIs. I'm not sure whether it's a right solution ? I think the problem is we want to distinguish below 3 scenarios,
Both three will call But there's another new issue. When compiling with |
51fbc2e to
a6c96b8
Compare
kito-cheng
left a comment
There was a problem hiding this comment.
Only one minor comment, you can go to mailing list after you address that :)
| for a call to a function whose data type is FNTYPE. | ||
| For a library call, FNTYPE is 0. */ | ||
|
|
||
| void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); |
There was a problem hiding this comment.
Rename to riscv_init_cumulative_args and put into riscv-protos.h.
This patch adds support to check function's argument or return is vector type and throw warning.
gcc/ChangeLog:
gcc/testsuite/ChangeLog: