public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: jinma <ijinma@yeah.net>, gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "kito.cheng" <kito.cheng@sifive.com>,
	"kito.cheng" <kito.cheng@gmail.com>, palmer <palmer@dabbelt.com>
Subject: Re: [PATCH v8] RISC-V: Add the 'zfa' extension, version 0.2.
Date: Mon, 15 May 2023 21:59:43 -0600	[thread overview]
Message-ID: <5df70b7d-06fb-f0ba-10f6-bf88a5c06b73@gmail.com> (raw)
In-Reply-To: <b98f17f7-7bde-4f02-ad2e-d44bfd1c5769.jinma@linux.alibaba.com>



On 5/6/23 06:53, jinma wrote:
>>>> diff --git a/gcc/config/riscv/iterators.md b/gcc/config/riscv/iterators.md
>>>> index 9b767038452..c81b08e3cc5 100644
>>>> --- a/gcc/config/riscv/iterators.md
>>>> +++ b/gcc/config/riscv/iterators.md
>>>> @@ -288,3 +288,8 @@ (define_int_iterator QUIET_COMPARISON [UNSPEC_FLT_QUIET UNSPEC_FLE_QUIET])
>>>>    (define_int_attr quiet_pattern [(UNSPEC_FLT_QUIET "lt") (UNSPEC_FLE_QUIET "le")])
>>>>    (define_int_attr QUIET_PATTERN [(UNSPEC_FLT_QUIET "LT") (UNSPEC_FLE_QUIET "LE")])
>>>>    
>>>> +(define_int_iterator ROUND [UNSPEC_ROUND UNSPEC_FLOOR UNSPEC_CEIL UNSPEC_BTRUNC UNSPEC_ROUNDEVEN UNSPEC_NEARBYINT])
>>>> +(define_int_attr round_pattern [(UNSPEC_ROUND "round") (UNSPEC_FLOOR "floor") (UNSPEC_CEIL "ceil")
>>>> +				(UNSPEC_BTRUNC "btrunc") (UNSPEC_ROUNDEVEN "roundeven") (UNSPEC_NEARBYINT "nearbyint")])
>>>> +(define_int_attr round_rm [(UNSPEC_ROUND "rmm") (UNSPEC_FLOOR "rdn") (UNSPEC_CEIL "rup")
>>>> +			   (UNSPEC_BTRUNC "rtz") (UNSPEC_ROUNDEVEN "rne") (UNSPEC_NEARBYINT "dyn")])
>>> Do we really need to use unspecs for all these cases?  I would expect
>>> some correspond to the trunc, round, ceil, nearbyint, etc well known RTX
>>> codes.
>>>
>>> In general, we should try to avoid unspecs when there is a clear
>>> semantic match between the instruction and GCC's RTX opcodes.  So please
>>> review the existing RTX code semantics to see if any match the new
>>> instructions.  If there are matches, use those RTX codes rather than
>>> UNSPECs.
>>
>> I'll try, thanks.
> 
> 
> I encountered some confusion about this. I checked gcc's documents and
> found no RTX codes that can correspond to round, ceil, nearbyint, etc.
> Only "(fix:m x)" seems to correspond to trunc, which can be expressed
> as rounding towards zero, while others have not yet been found.
You're largely correct.  My bad.  There's named patterns for round to 
integer, nearbyint, etc, but no RTX codes.  So they need to be handled 
as unspecs.  Sorry fo the confusion.

Jeff

  reply	other threads:[~2023-05-16  3:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  9:57 Jin Ma
2023-05-05 15:03 ` Christoph Müllner
2023-05-05 15:04   ` Christoph Müllner
2023-05-05 15:12     ` Palmer Dabbelt
2023-05-05 15:43       ` Christoph Müllner
2023-05-05 23:31 ` Jeff Law
2023-05-06  7:54 ` Jin Ma
2023-05-06 12:53   ` jinma
2023-05-16  3:59     ` Jeff Law [this message]
2023-05-15 13:16 ` [PATCH v9] " Jin Ma
2023-05-15 13:30   ` jinma
2023-05-16  4:00     ` Jeff Law
2023-05-16  4:16   ` Jeff Law
2023-05-16  7:06     ` jinma
2023-05-16  7:53       ` Kito Cheng
2023-08-09 18:11       ` Vineet Gupta
2023-08-11 15:49         ` Jin Ma
2023-08-14  6:00         ` Jin Ma
2023-08-14  6:10           ` Jin Ma
2023-08-14 22:11             ` Jeff Law

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=5df70b7d-06fb-f0ba-10f6-bf88a5c06b73@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ijinma@yeah.net \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.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).