public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Xiao Zeng <zengxiao@eswincomputing.com>, gcc-patches@gcc.gnu.org
Cc: research_trasio@irq.a4lg.com, kito.cheng@gmail.com,
	palmer@dabbelt.com, zhengyu@eswincomputing.com
Subject: Re: [PATCH v1 1/1] RISC-V: Nan-box the result of movbf on soft-bf16
Date: Wed, 8 May 2024 14:01:07 -0600	[thread overview]
Message-ID: <f8c30262-87b0-4b27-97ba-9ef849e93f62@gmail.com> (raw)
In-Reply-To: <20240508003809.24556-2-zengxiao@eswincomputing.com>



On 5/7/24 6:38 PM, Xiao Zeng wrote:
> 1 This patch implements the Nan-box of bf16.
> 
> 2 Please refer to the Nan-box implementation of hf16 in:
> <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=057dc349021660c40699fb5c98fd9cac8e168653>
> 
> 3 The discussion about Nan-box can be found on the website:
> <https://www.mail-archive.com/search?q=Nan-box+the+result+of+movhf+on+soft-fp16&l=gcc-patches%40gcc.gnu.org>
> 
> 4 Below test are passed for this patch
>          * The riscv fully regression test.
> 
> gcc/ChangeLog:
> 
> 	* config/riscv/riscv.cc (riscv_legitimize_move): Expand movbf
> 	with Nan-boxing value.
> 	* config/riscv/riscv.md (*movbf_softfloat_boxing): New pattern.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/_Bfloat16-nanboxing.c: New test.
> ---
>   gcc/config/riscv/riscv.cc                     | 51 ++++++++++---------
>   gcc/config/riscv/riscv.md                     | 12 ++++-
>   .../gcc.target/riscv/_Bfloat16-nanboxing.c    | 38 ++++++++++++++
>   3 files changed, 76 insertions(+), 25 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c
> 
> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index 545e68566dc..be2cb245733 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -3120,35 +3120,38 @@ riscv_legitimize_move (machine_mode mode, rtx dest, rtx src)

>   
> - if (TARGET_HARD_FLOAT
> -     && !TARGET_ZFHMIN && mode == HFmode
> -     && REG_P (dest) && FP_REG_P (REGNO (dest))
> -     && REG_P (src) && !FP_REG_P (REGNO (src))
> -     && can_create_pseudo_p ())
[ ... ]

> +  if (TARGET_HARD_FLOAT
> +      && ((!TARGET_ZFHMIN && mode == HFmode)
> +	  || (!TARGET_ZFBFMIN && mode == BFmode))
> +      && REG_P (dest) && FP_REG_P (REGNO (dest)) && REG_P (src)
> +      && !FP_REG_P (REGNO (src)) && can_create_pseudo_p ())

So there's a bit of gratutious rewriting going on here.  I realize you 
were fixing formatting problems (thanks!), but I don't see a need to 
rewriting the tests starting with REG_P.  I put those back in their 
original form with the whitespace fixes.

I'll push the fixed version momentarily.

Thanks again!

jeff



  reply	other threads:[~2024-05-08 20:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  0:38 [PATCH v1 0/1] " Xiao Zeng
2024-05-08  0:38 ` [PATCH v1 1/1] " Xiao Zeng
2024-05-08 20:01   ` Jeff Law [this message]
2024-05-13  2:24     ` Xiao Zeng

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=f8c30262-87b0-4b27-97ba-9ef849e93f62@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=research_trasio@irq.a4lg.com \
    --cc=zengxiao@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).