public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: "Maciej W. Rozycki" <macro@embecosm.com>
Cc: Jim Wilson <jim.wilson.gcc@gmail.com>,
	Kito Cheng <kito.cheng@sifive.com>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	andrew@sifive.com, gcc-patches@gcc.gnu.org,
	 joseph@codesourcery.com, juzhe.zhong@rivai.ai
Subject: Re: [PATCH v2 1/2] RISC-V: Support _Float16 type.
Date: Wed, 7 Dec 2022 22:15:31 +0800	[thread overview]
Message-ID: <CA+yXCZA-uo03+fk+JfX=VH_4x2sVcopOt__MysWf7dnR5EVJ_g@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.2212051305120.7841@tpp.orcam.me.uk>

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

Hi Maciej:

It’s not intentionally, I suspect that is because I port from our internal
old gcc branch, will send patch to fix that later, thanks for catching this!

Maciej W. Rozycki <macro@embecosm.com>於 2022年12月5日 週一,21:05寫道:

> Hi Kito,
>
>  I came across this issue while inspecting code and I have been wondering
> what the reason was to downgrade current FMV.X.W and FMW.W.X instructions
> to their older FMV.S.W and FMV.W.S variants here:
>
> On Wed, 10 Aug 2022, Kito Cheng wrote:
>
> > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> > index 5a0adffb5ce..47e6110767c 100644
> > --- a/gcc/config/riscv/riscv.cc
> > +++ b/gcc/config/riscv/riscv.cc
> > @@ -2308,10 +2310,19 @@ riscv_output_move (rtx dest, rtx src)
> >    if (dest_code == REG && GP_REG_P (REGNO (dest)))
> >      {
> >        if (src_code == REG && FP_REG_P (REGNO (src)))
> > -     return dbl_p ? "fmv.x.d\t%0,%1" : "fmv.x.w\t%0,%1";
> > +     switch (width)
> > +       {
> > +       case 2:
> > +         /* Using fmv.x.s + sign-extend to emulate fmv.x.h.  */
> > +         return "fmv.x.s\t%0,%1;slli\t%0,%0,16;srai\t%0,%0,16";
> > +       case 4:
> > +         return "fmv.x.s\t%0,%1";
> > +       case 8:
> > +         return "fmv.x.d\t%0,%1";
> > +       }
>
> and here:
>
> > @@ -2353,18 +2364,24 @@ riscv_output_move (rtx dest, rtx src)
> >           return "mv\t%0,%z1";
> >
> >         if (FP_REG_P (REGNO (dest)))
> > -         {
> > -           if (!dbl_p)
> > -             return "fmv.w.x\t%0,%z1";
> > -           if (TARGET_64BIT)
> > -             return "fmv.d.x\t%0,%z1";
> > -           /* in RV32, we can emulate fmv.d.x %0, x0 using fcvt.d.w */
> > -           gcc_assert (src == CONST0_RTX (mode));
> > -           return "fcvt.d.w\t%0,x0";
> > -         }
> > +         switch (width)
> > +           {
> > +           case 2:
> > +             /* High 16 bits should be all-1, otherwise HW will treated
> > +                as a n-bit canonical NaN, but isn't matter for
> softfloat.  */
> > +             return "fmv.s.x\t%0,%1";
> > +           case 4:
> > +             return "fmv.s.x\t%0,%z1";
> > +           case 8:
> > +             if (TARGET_64BIT)
> > +               return "fmv.d.x\t%0,%z1";
> > +             /* in RV32, we can emulate fmv.d.x %0, x0 using fcvt.d.w */
>
> (Incorrect comment formatting here as well.)
>
> > +             gcc_assert (src == CONST0_RTX (mode));
> > +             return "fcvt.d.w\t%0,x0";
> > +           }
>
> Was it intentional or just an oversight in review?  If intentional, I'd
> expect such a change to happen on its own rather than sneaked in with a
> large functional update.
>
>   Maciej
>

      reply	other threads:[~2022-12-07 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 15:44 Kito Cheng
2022-08-10 15:44 ` [PATCH v2 2/2] RISC-V: Support zfh and zfhmin extension Kito Cheng
2022-08-10 23:19   ` 钟居哲
2022-12-05 13:05 ` [PATCH v2 1/2] RISC-V: Support _Float16 type Maciej W. Rozycki
2022-12-07 14:15   ` 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+yXCZA-uo03+fk+JfX=VH_4x2sVcopOt__MysWf7dnR5EVJ_g@mail.gmail.com' \
    --to=kito.cheng@gmail.com \
    --cc=andrew@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@sifive.com \
    --cc=macro@embecosm.com \
    --cc=palmer@dabbelt.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).