public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: "Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Liao Shihua" <shihua@iscas.ac.cn>
Cc: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com,
	shiyulong@iscas.ac.cn, jiawei@iscas.ac.cn,
	chenyixuan@iscas.an.cn
Subject: Re: [PATCH] RISC-V: fix scalar crypto pattern
Date: Wed, 13 Dec 2023 17:40:29 -0700	[thread overview]
Message-ID: <eaf84d97-b162-467b-b7f7-32dec160084f@gmail.com> (raw)
In-Reply-To: <CAEg0e7gMmGxfin56-+yCcDVVj+KpRAv3mWbOqMpq=n2V47b8hA@mail.gmail.com>



On 12/13/23 02:03, Christoph Müllner wrote:
> On Wed, Dec 13, 2023 at 9:22 AM Liao Shihua <shihua@iscas.ac.cn> wrote:
>>
>> In Scalar Crypto Built-In functions, some require immediate parameters,
>> But register_operand are incorrectly used in the pattern.
>>
>> E.g.:
>>     __builtin_riscv_aes64ks1i(rs1,1)
>>     Before:
>>        li a5,1
>>        aes64ks1i a0,a0,a5
>>
>>        Assembler messages:
>>        Error: instruction aes64ks1i requires absolute expression
>>
>>     After:
>>        aes64ks1i a0,a0,1
> 
> Looks good to me (also tested with rv32 and rv64).
> (I was actually surprised that the D03 constraint was not sufficient)
> 
> Reviewed-by: Christoph Muellner <christoph.muellner@vrull.eu>
> Tested-by: Christoph Muellner <christoph.muellner@vrull.eu>
> 
> Nit: I would prefer to separate arguments with a comma followed by a space.
> Even if the existing code was not written like that.
> E.g. __builtin_riscv_sm4ed(rs1,rs2,1); -> __builtin_riscv_sm4ed(rs1, rs2, 1);
> 
> I propose to remove the builtin tests for scalar crypto and scalar bitmanip
> as part of the patchset that adds the intrinsic tests (no value in
> duplicated tests).
> 
>> gcc/ChangeLog:
>>
>>          * config/riscv/crypto.md: Use immediate_operand instead of register_operand.
You should mention the actual patterns changed.

I would strongly recommend adding some tests that out of range cases are 
rejected (out of range constants as well as a variable for that last 
argument).  I did that in my patch from June to fix this problem (which 
was never acked/reviewed).

Jeff

  reply	other threads:[~2023-12-14  0:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  8:22 Liao Shihua
2023-12-13  9:03 ` Christoph Müllner
2023-12-14  0:40   ` Jeff Law [this message]
2023-12-14  9:48     ` Christoph Müllner
2023-12-14 11:12       ` Liao Shihua
2023-12-14 19:31         ` Jeff Law
2023-12-14 14:57       ` Jeff Law
2023-12-14 19:30       ` 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=eaf84d97-b162-467b-b7f7-32dec160084f@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=chenyixuan@iscas.an.cn \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jiawei@iscas.ac.cn \
    --cc=kito.cheng@gmail.com \
    --cc=shihua@iscas.ac.cn \
    --cc=shiyulong@iscas.ac.cn \
    /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).