public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <jimw@sifive.com>
To: Kito Cheng <kito.cheng@sifive.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Kito Cheng <kito.cheng@gmail.com>
Subject: Re: [PATCH] RISC-V: Implment __builtin_thread_pointer
Date: Wed, 8 Jul 2020 12:59:21 -0700	[thread overview]
Message-ID: <CAFyWVaZiY6He29X5Mu6GExj57qAqe0aCJV=8K7OcuR3q++zT2g@mail.gmail.com> (raw)
In-Reply-To: <20200707095214.65476-1-kito.cheng@sifive.com>

On Tue, Jul 7, 2020 at 2:52 AM Kito Cheng <kito.cheng@sifive.com> wrote:
> gcc/ChangeLog:
>         * gcc/config/riscv/riscv.md (): New.
>         (TP_REGNUM): Ditto.
>         * doc/extend.texi (Target Builtins): Add RISC-V built-in section.
>         Document __builtin_thread_pointer.
> gcc/testsuite/ChangeLog:
>         * gcc.target/riscv/read-thread-pointer.c: New.

It looks OK to me in general.

You added builtin_thread_pointer but not builtin_set_thread_pointer.
Maybe we should implement both as long as we are implementing one?  If
clang only implements one, maybe it should implement the other also?
This doesn't have to be part of this patch.  This could be a separate
issue.

The builtin_thread_pointer docs looks out-of-date.  It is documented
for alpha and SH, but it is implemented in gcc/builtins.c not in the
backends.  A scan of md files show that quite a few targets support it
but don't document it.  I think it should be documented in the generic
builtins section not in the target dependent builtins sections with
some language that says not all targets support it.  This doesn't have
to be part of this patch.  This could be a separate issue.

We have two existing undocumented builtins.  __builtin_riscv_fsflags
and __builtin_riscv_frflags for setting or reading the FP flags.  I
don't know if anyone uses them though.  newlib and glbic both use
extended asms for these operations.  This doesn't have to be part of
this patch.  This could be a separate issue.

There is a document https://github.com/riscv/riscv-c-api-doc for
coordinating gcc and llvm work that has an empty list of builtin
functions.  I'm not sure if this document is still useful.  If this is
a RISC-V specific builtin then it should be listed here, but I don't
think it should be considered a RISC-V specific builtin.  There is an
unresolved pull request for the frflags and fsflags builtins.  I guess
I forgot about that.

Jim

  reply	other threads:[~2020-07-08 19:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  9:52 Kito Cheng
2020-07-08 19:59 ` Jim Wilson [this message]
2020-07-09  6:48   ` Kito Cheng
2020-07-09  6:52     ` Kito Cheng
2021-03-01  8:17   ` Matthias Klose
2021-03-02  9:57     ` Kito Cheng

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='CAFyWVaZiY6He29X5Mu6GExj57qAqe0aCJV=8K7OcuR3q++zT2g@mail.gmail.com' \
    --to=jimw@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.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).