public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
To: kito.cheng <kito.cheng@gmail.com>,  jinma <jinma@linux.alibaba.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	 jeffreyalaw <jeffreyalaw@gmail.com>,
	 palmer <palmer@dabbelt.com>,
	 richard.sandiford <richard.sandiford@arm.com>,
	 philipp.tomsich <philipp.tomsich@vrull.eu>,
	 christoph.muellner <christoph.muellner@vrull.eu>,
	 "Robin Dapp" <rdapp.gcc@gmail.com>,
	 jinma.contrib <jinma.contrib@gmail.com>
Subject: Re: Re: [PATCH v4] RISC-V: Fixbug for fsflags instruction error using immediate.
Date: Wed, 26 Jul 2023 15:19:40 +0800	[thread overview]
Message-ID: <96BD8787292DAB06+2023072615194017244950@rivai.ai> (raw)
In-Reply-To: <CA+yXCZC5z7LM7+7teo0Nuf0CE7RQ43RsR84DsDg3_ubaNreV-g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]

I just checked SPEC:

fscsr rd, rs csrrw rd, fcsr, rs 
Swap FP control/status register 
fscsr rs csrrw x0, fcsr, rs 
Write FP control/status register 

It seems that fscsr doesn't have immediate form? I am not sure.


juzhe.zhong@rivai.ai
 
From: Kito Cheng
Date: 2023-07-26 15:07
To: Jin Ma
CC: gcc-patches; jeffreyalaw; palmer; richard.sandiford; philipp.tomsich; christoph.muellner; rdapp.gcc; juzhe.zhong; jinma.contrib
Subject: Re: [PATCH v4] RISC-V: Fixbug for fsflags instruction error using immediate.
On Wed, Jul 26, 2023 at 1:41 PM Jin Ma via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The pattern mistakenly believes that fsflags can use immediate numbers,
> but in fact it does not support it. Immediate numbers should use fsflagsi.
>
> For example:
> __builtin_riscv_fsflags(4);
>
> The following error occurred.
> /tmp/ccoWdWqT.s: Assembler messages:
> /tmp/ccoWdWqT.s:14: Error: illegal operands `fsflags 4'
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv.md: Likewise.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/riscv/fsflags.c: New test.
> ---
>  gcc/config/riscv/riscv.md                |  4 ++--
>  gcc/testsuite/gcc.target/riscv/fsflags.c | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/riscv/fsflags.c
>
> diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
> index 4615e811947..24515bcf706 100644
> --- a/gcc/config/riscv/riscv.md
> +++ b/gcc/config/riscv/riscv.md
> @@ -3074,7 +3074,7 @@ (define_insn "riscv_frcsr"
>    "frcsr\t%0")
>
>  (define_insn "riscv_fscsr"
> -  [(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSCSR)]
> +  [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] UNSPECV_FSCSR)]
>    "TARGET_HARD_FLOAT || TARGET_ZFINX"
>    "fscsr\t%0")
 
Wait, this patch still drops K?
 

  reply	other threads:[~2023-07-26  7:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  6:39 [PATCH] " Jin Ma
2023-07-25  6:48 ` Robin Dapp
2023-07-25  7:32   ` Jin Ma
2023-07-25  7:28 ` [PATCH v2] " Jin Ma
2023-07-25 11:00   ` Kito Cheng
2023-07-26  2:17     ` [PATCH v3] " Jin Ma
2023-07-26  2:30       ` juzhe.zhong
2023-07-26  3:33         ` Jin Ma
2023-07-26  3:41           ` juzhe.zhong
2023-07-26  3:45             ` Kito Cheng
2023-07-26  3:49               ` juzhe.zhong
2023-07-26  5:36                 ` Jin Ma
2023-07-26  5:41         ` [PATCH v4] " Jin Ma
2023-07-26  6:04           ` juzhe.zhong
2023-07-26  7:07           ` Kito Cheng
2023-07-26  7:19             ` juzhe.zhong [this message]
2023-07-26  7:39               ` Kito Cheng
2023-07-26  8:22                 ` 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=96BD8787292DAB06+2023072615194017244950@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jinma.contrib@gmail.com \
    --cc=jinma@linux.alibaba.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=rdapp.gcc@gmail.com \
    --cc=richard.sandiford@arm.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).