From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 950763858C2C for ; Thu, 14 Dec 2023 00:40:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 950763858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 950763858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702514442; cv=none; b=Sp3ztpK/36WW+Udj3QXBZy3M7R6SeZGNbBtqNZKl/W9yvCCIymfMypurpk6FoENVO+kZ9iZHAJfLzAM7n+meSF3ZyhJ9J+0XAzzbCxZ2TLy1ZeVObdtFKcB+nqTRaeUAzubSTnZqs/wJL8v9EvLHMT0nuthPu+qWnZInfNQPRMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702514442; c=relaxed/simple; bh=4vU62aiqqcKuqeArXTN9pA2eYYFiQxJlN188IVsD9xg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Drs5wPQ7KtdT/Y3KwLKGGDbFlHbZJHC2MLyZ/yhOp1KRFLsOlV4YSMM5a3pD26IQ2Fr9a89lntk769M2kFLt1Y0SBFPyoPY0Iby8cDb1xQ/MO83rcXP6zydm0z6LAk+fLxAuu4t2f34qrh/yFuFqBm+9rqPKH9hlfWTV2V0pqro= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6ce72730548so6925315b3a.1 for ; Wed, 13 Dec 2023 16:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702514436; x=1703119236; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kUJcpzv2MY3l85U6IsA9xDnlw1xs0pUvzblpX84h1qo=; b=h8qGO81xVRCz9RIW24f0v4qhprbyluI5X4rXNVSnDjqxVaQW+XXl/+bAQq+rrjtcHf sQMUelgDb9i/fBLoA9+/9GYphKi7bzdUU8bvJV3goc+M6AkQPQAJatr7qOXyKjq593oH rISDrVY2rKfnmxqlMZqhVU8QivlZF2JQI99SY4j/bfhFbGQsrCAKw23XHG0BHmekdBhB uAkas59lqVue+BMCGF7yqVn15sX9TdnLSnsQBboJEi+qT6hsPRn0fBeGyG037TIz3oKz 73gYf7Lgmp6YkAqbAsRuhjHIypqiVXnpS6dS37KXKVDjBqT47RHw8LOmJvo2f/6UsiIv /3Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702514436; x=1703119236; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kUJcpzv2MY3l85U6IsA9xDnlw1xs0pUvzblpX84h1qo=; b=ikHXAbqDfRoWzHEfuYX+s1cQlnh+vByobTvL5MrV1fuedEnyYR+TwU9k6F7puLOv9h L3+HWcRUGIPqHr+C/ryDPfjoWIf1UOr2Sdvohz3mZIjl+qfDXSbH6wLTOWlr6Km63Si3 TS/Q6GJLmkqOK7JuMsr4UOZ9cDZSNReyeFTaXKIhGljp5NugWOzixmS9/HBT4W58Y3b5 r3R+ERpSzqHyofyCHBbRdhgs7MCn/TlJfke1kxL094GbILosc+x3oeZ45a7FRuPyqndu fl9wnxcxxIsPCcZfBQ2jIqP41AG6pXWgV/6fw54XCepEHaqkaIYuti2aJSY1BvCOLt+Z gW4Q== X-Gm-Message-State: AOJu0YwJlXwHxxtm1bhLu/yRLalk/DFS3CUCIINT7Y++S3LBxlJ32qr/ AOFn4lK22DyxunGqtijXKIGOAt5dkxw= X-Google-Smtp-Source: AGHT+IFrexiCDIN3RauHAQE2pmcNoImzVR7dx5A7HUYWLPVCBwaXM3Vvhx+HpZimxj9OLVMLoJjc9w== X-Received: by 2002:a05:6a20:4b21:b0:190:6617:270e with SMTP id fp33-20020a056a204b2100b001906617270emr9419307pzb.41.1702514436261; Wed, 13 Dec 2023 16:40:36 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id x20-20020a631714000000b0058988954686sm10092224pgl.90.2023.12.13.16.40.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Dec 2023 16:40:35 -0800 (PST) Message-ID: Date: Wed, 13 Dec 2023 17:40:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] RISC-V: fix scalar crypto pattern Content-Language: en-US To: =?UTF-8?Q?Christoph_M=C3=BCllner?= , Liao Shihua Cc: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, shiyulong@iscas.ac.cn, jiawei@iscas.ac.cn, chenyixuan@iscas.an.cn References: <20231213082244.3760797-1-shihua@iscas.ac.cn> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/13/23 02:03, Christoph Müllner wrote: > On Wed, Dec 13, 2023 at 9:22 AM Liao Shihua 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 > Tested-by: Christoph Muellner > > 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