public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: daichengrong@iscas.ac.cn, libc-alpha@sourceware.org
Cc: aswaterman@gmail.com, palmer@rivosinc.com, darius@bluespec.com,
	jiageng08@iscas.ac.cn
Subject: Re: [PATCH v4 1/4] add a configure test to check if the compiler supports rvv
Date: Wed, 22 Jan 2025 09:16:57 -0300	[thread overview]
Message-ID: <6502a460-c244-4ba8-8716-cc364005e8c0@linaro.org> (raw)
In-Reply-To: <20250122020401.187099-2-daichengrong@iscas.ac.cn>



On 21/01/25 23:03, daichengrong@iscas.ac.cn wrote:
> From: daichengrong <daichengrong@iscas.ac.cn>
> 
> ---
>  config.h.in  |  3 +++
>  configure    | 35 +++++++++++++++++++++++++++++++++++
>  configure.ac | 25 +++++++++++++++++++++++++
>  3 files changed, 63 insertions(+)
> 
> diff --git a/config.h.in b/config.h.in
> index cdbd555366..d1e84b6c07 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -211,6 +211,9 @@
>  /* Define if gcc supports attribute ifunc.  */
>  #undef HAVE_GCC_IFUNC
>  
> +/* Define if gcc supports riscv vector.  */
> +#undef HAVE_GCC_RISCV_VECTOR
> +
>  /* Define if CC supports attribute retain.  */
>  #undef HAVE_GNU_RETAIN
>  
> diff --git a/configure b/configure
> index eb8abd0054..58af3a213f 100755
> --- a/configure
> +++ b/configure
> @@ -6375,6 +6375,33 @@ fi
>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_textrel_ifunc" >&5
>  printf "%s\n" "$libc_cv_textrel_ifunc" >&6; }
>  
> +# Check if gcc supports attribute riscv vector.
> +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc attribute riscv vector support" >&5
> +printf %s "checking for gcc attribute riscv vector support... " >&6; }
> +if test ${libc_cv_gcc_rvv+y}
> +then :
> +  printf %s "(cached) " >&6
> +else case e in #(
> +  e) cat > conftest.c <<EOF
> +int used_func (int a)
> +{
> +  return a;
> +}
> +static void *resolver ()
> +{
> +  return &used_func;
> +}
> +EOF
> +libc_cv_gcc_rvv=no
> +if ${CC-cc} -march=rv64gcv -c conftest.c -o conftest.o 1>&5 \
> +   2>&5 ; then
> +  libc_cv_gcc_rvv=yes
> +fi
> +rm -f conftest* ;;
> +esac
> +fi
> +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_rvv" >&5
> +printf "%s\n" "$libc_cv_gcc_rvv" >&6; }
>  
>  # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU attribute retain support" >&5
> @@ -8759,6 +8786,14 @@ fi
>  config_vars="$config_vars
>  have-gcc-ifunc = $libc_cv_gcc_indirect_function"
>  
> +if test x"$libc_cv_gcc_rvv" = xyes; then
> +  printf "%s\n" "#define HAVE_GCC_RISCV_VECTOR 1" >>confdefs.h
> +
> +fi
> +config_vars="$config_vars
> +have-gcc-riscv-rvv = $libc_cv_gcc_rvv"
> +
> +
>  # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
>  # configure fragment can override the value to prevent this AC_DEFINE.
>  
> diff --git a/configure.ac b/configure.ac
> index 050bfa65e3..0f8c497e9a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -829,6 +829,31 @@ fi
>  rm -f conftest*])
>  AC_SUBST(libc_cv_textrel_ifunc)
>  
> +# Check if gcc supports attribute riscv vector macro.
> +AC_CACHE_CHECK([for gcc attribute riscv vector support],
> +	       libc_cv_gcc_rvv, [dnl
> +cat > conftest.c <<EOF
> +int used_func (int a)
> +{
> +  return a;
> +}
> +static void *resolver ()
> +{
> +  return &used_func;
> +}
> +EOF
> +libc_cv_gcc_rvv=no
> +if ${CC-cc} -march=rv64gcv -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
> +   2>&AS_MESSAGE_LOG_FD ; then
> +  libc_cv_gcc_rvv=yes
> +fi
> +rm -f conftest*])
> +
> +if test x"$libc_cv_gcc_rvv" = xyes; then
> +  AC_DEFINE(HAVE_GCC_RISCV_VECTOR)
> +fi
> +LIBC_CONFIG_VAR([have-gcc-riscv-rvv], [$libc_cv_gcc_rvv])

Strictly you only need to check if assembler supports -march=rv64gcv, and I think
it would be better to move it to sysdeps/riscv/configure.ac

> +
>  # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
>  AC_CACHE_CHECK([for GNU attribute retain support],
>  	       libc_cv_gnu_retain, [dnl


  reply	other threads:[~2025-01-22 12:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  2:03 [PATCH v4 0/4] RISC-V: add multiarch RVV support for memcpy using FMV IFUNC daichengrong
2025-01-22  2:03 ` [PATCH v4 1/4] add a configure test to check if the compiler supports rvv daichengrong
2025-01-22 12:16   ` Adhemerval Zanella Netto [this message]
2025-01-22  2:03 ` [PATCH v4 2/4] add macro support for dl_hwcap daichengrong
2025-01-22  2:04 ` [PATCH v4 3/4] add rvv memcpy in ifunc-impl-list daichengrong
2025-01-22 12:19   ` Adhemerval Zanella Netto
2025-01-22 16:34   ` Darius Rad
2025-01-22  2:04 ` [PATCH v4 4/4] add riscv vector support for memcpy daichengrong
2025-01-22 12:30   ` Adhemerval Zanella Netto

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=6502a460-c244-4ba8-8716-cc364005e8c0@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=aswaterman@gmail.com \
    --cc=daichengrong@iscas.ac.cn \
    --cc=darius@bluespec.com \
    --cc=jiageng08@iscas.ac.cn \
    --cc=libc-alpha@sourceware.org \
    --cc=palmer@rivosinc.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).