public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Li Xu <xuli1@eswincomputing.com>
Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com,
	juzhe.zhong@rivai.ai,  zhengyu@eswincomputing.com
Subject: Re: [PATCH] RISC-V: Add riscv_vector_cc function attribute
Date: Fri, 1 Mar 2024 16:26:34 +0800	[thread overview]
Message-ID: <CA+yXCZAOVfvns+RGmQXFG5L_TT-teFhsWX4Wb5x6AJ0JUEuhkQ@mail.gmail.com> (raw)
In-Reply-To: <20240227011714.25482-1-xuli1@eswincomputing.com>

Thanks for your patch! this is generally in good shape, just a few
minor comments :)


> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 2135dfde9c8..afe486ba47b 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -6314,6 +6314,18 @@ Permissible values for this parameter are @code{user}, @code{supervisor},
>  and @code{machine}.  If there is no parameter, then it defaults to
>  @code{machine}.
>
> +@cindex @code{riscv_vector_cc} function attribute, RISC-V
> +@item riscv_vector_cc
> +Use this attribute to force the function to use the vector calling
> +convention variant.
> +For more information on riscv_vector_cc, please see
> +@uref{https://github.com/riscv-non-isa/riscv-c-api-doc/pull/67}

Please remove above two line, I guess it's not good idea to reference
a pull request link here :P

> +
> +@smallexample
> +void foo() __attribute__((riscv_vector_cc));
> +[[riscv::vector_cc]] void foo(); // For C++11 and C23
> +@end smallexample
> +
>  @end table
>
>  The following target-specific function attributes are available for the

> diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/attribute-riscv_vector_cc-callee-saved.c b/gcc/testsuite/gcc.target/riscv/rvv/base/attribute-riscv_vector_cc-callee-saved.c
> new file mode 100644
> index 00000000000..7db9d874bcd
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/attribute-riscv_vector_cc-callee-saved.c
> @@ -0,0 +1,117 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64gcv -mabi=lp64d -O1" } */
> +/* { dg-final { check-function-bodies "**" "" } } */

I would like to prevent scanning the asm body if possible, since it
might cause problem when we improving code gen, so could you try to
scan .variant_cc\t<funcname> like
gcc/testsuite/gcc.target/aarch64/pcs_attribute-3.c?

Then we can also drop -O1 in the option :)

> +
> +#include <stdint.h>

Drop this.


> +void __attribute__((riscv_vector_cc))
> +foo2 (int a)
> +{
> +  int8_t data[1024];

Just char rather than int8_t, I would like to remove unnecessary
header including if possible :)

      parent reply	other threads:[~2024-03-01  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  1:17 Li Xu
2024-02-27  1:22 ` juzhe.zhong
2024-03-01  1:56 ` Li Xu
2024-03-01  8:26 ` Kito Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+yXCZAOVfvns+RGmQXFG5L_TT-teFhsWX4Wb5x6AJ0JUEuhkQ@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=palmer@dabbelt.com \
    --cc=xuli1@eswincomputing.com \
    --cc=zhengyu@eswincomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).