From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by sourceware.org (Postfix) with ESMTPS id E823D3858406 for ; Tue, 4 Jan 2022 13:13:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E823D3858406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=pqshield.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pqshield.com Received: by mail-ua1-x929.google.com with SMTP id c36so37549649uae.13 for ; Tue, 04 Jan 2022 05:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqshield-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wL24BYXbO2uA29B63cDH8bF7ENzmIBz3CTD9nBSAmOk=; b=2iPbmrsKfvbJD8q/wUbeD/NX7atw2CQp7SqdqGaW3AjHUEUZsZuxTFcpNAqOLNfv26 QyQpAo9Gsrsau8ZRqvIszTIh14SfKuMcBrTgha4kATXOhWUTJoccKsVhbYjUyiUFgFZP Gth5CdPpgxAXr4EIDG8EU1EU0ZEaVWrYDhWSgfCJig3fw59GGYy8kz4lVDaygqAbMTuz HdS44t5aLly9zVBdZ7Ya9sqNn42CIuKIJf53gagwxv0/a2gpZ46uZ7M8ktG8y+6jUSqT ZLla4q5MsI7ewuoKnWRZ25BeCk4QS68ZDQJ3meiavWWE4c4xfogk+RxPlqbmaeFg6Wsz RJpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wL24BYXbO2uA29B63cDH8bF7ENzmIBz3CTD9nBSAmOk=; b=aXjdO+IRk1Db2BWyw+i/LerUUbzjq7zrV82zerMo8PgufOMBzlvogfTXFdXgGR7cdv 2Y/X0oZR/wgK791O1JqcVowF+1aLb4W9ZbaEaRkCL+5nGQwuLPFHLnkQ1KdXoGrcP0m5 5Gozp6w6C9VtrO9rPcDIeqhFENdgzb7Jg1oYVYuhRGv7bxRvr+0ug1ckkmXGqZgbdpCX wlulPuD73TURildqH7YIHTwWdT5xhgyr4dh0XI6omeIcRSCFCoMnwQr0WdeNndYK53Ef is0CpzVy1Ef4QbVwlVd/pu2frfWnKYzK6qu8aRRYsSOOOim07H3W9LeN1V/gnTobiDOA Pffw== X-Gm-Message-State: AOAM530w5myMZswjTTG3bBgTO9u7mb/Zyli/gjHdT9/x9BcsFq3qXTHj tv1TLBXOWUrt3E0Xvh6pYLDKqMvYVE7AodEpsc5C/Q== X-Google-Smtp-Source: ABdhPJwv9z+w9hfV6W9Uytb+13rNeS7i51s7DoUBH2Z52yTU8e3WPDCu4KOFSOTWT9o1pb+k6e5TiQEdmFIQdglEz94= X-Received: by 2002:ab0:330c:: with SMTP id r12mr6724548uao.67.1641302001520; Tue, 04 Jan 2022 05:13:21 -0800 (PST) MIME-Version: 1.0 References: <20211115030343.276103-1-jiawei@iscas.ac.cn> <20211115030343.276103-3-jiawei@iscas.ac.cn> <8b80997e-9bc8-2425-dd2d-dc7bd9e28b0a@suse.com> <3fabe6df.10ef.17e243dcae6.Coremail.jiawei@iscas.ac.cn> In-Reply-To: From: "Markku-Juhani O. Saarinen" Date: Tue, 4 Jan 2022 13:13:10 +0000 Message-ID: Subject: Re: [PATCH v4 2/3] RISC-V: Scalar crypto instructions and operand set To: Jan Beulich Cc: =?UTF-8?B?6ZmI5ZiJ54Kc?= , Kito Cheng , nelson.chu@sifive.com, Jim Wilson , Philipp Tomsich , Ben Marshall , Christoph Muellner , Palmer Dabbelt , Andrew Waterman , =?UTF-8?B?V2VpIFd1ICjlkLTkvJ8p?= , siyu@isrc.iscas.ac.cn, schwab@linux-m68k.org, binutils@sourceware.org X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2022 13:13:23 -0000 On Tue, Jan 4, 2022 at 8:49 AM Jan Beulich wrote: > > > > For these two and a few more with immediate operands and a trailing > 'i' > > > in the mnemonics: Shouldn't they have i-suffix-less pseudos, > matching > > > other insns with immediate operands? > > > > > > Jan > > > > I think the 'i' trailing is just a dinstinguishing symbol in zknd > extension, there are no i-suffix-less pseudo definitions in the cryptogrpah > extension spec, please check it. > > Perhaps I should have said explicitly that this is a question not so much > on the implementation, but on the spec itself. > Hi, I agree that it's a bit odd that sm4* instructions don't have an "i" but equivalent-format aes32* instructions have it. Hence I wouldn't assign too much meaning to the "i" here; there is no equivalent "register input" version for these as there would be with something like "addi" vs "add". For 32-bit aes/sm4 the immediate refers to a 2-bit field that could have even been incorporated into the mnemonic (e.g. sm4ed0, sm4ed1, sm4ed2, sm4ed3) -- to me, these instructions fundamentally have an R-type encoding. For aes64ks1i it's a 4-bit value holding 0x0..0xA. If we consider C language intrinsics, passing a variable as an immediate for K extension instruction needs to be an illegal operation: if the compiler generates some kind of switch-case statement, that is unlikely to be constant-time and defeats half of the purpose of the instruction. At least the inline assembler headers work this way; I hope proper builtins will fault at attempts to use variables too. Wrt to "the spec", the Scalar K spec was ratified in November. In the RISC-V process, ISA ratification means that those mnemonics are beyond "stable" and "freeze" stages in terms of unmovability. That would require really serious technical arguments. The consistency of mnemonic and opcode assignments is really a matter for the top architecture committee chairs, so even us in the committee that authored that spec did not have final control over them. Krste & Co changed some of the mnemonics (such as the names of xperm4 and xperm8) as late as August, before the ratification. One more thing about intrinsics: If we consider also Bitmanip intrinsics, my take is that if an instruction has both immediate and register-based form, it makes obvious sense to combine them into the same intrinsic (e.g. GREV and GREVI would be better served by a single intrinsic, even though they are separate mnemonics). K instructions only have one form -- one avoids confusion by using the mnemonic name to create an intrinsic function (with a consistent prefix). That's how the current C language intrinsic proposal works. Cheers, - markku Dr. Markku-Juhani O. Saarinen PQShield, Oxford UK. > > Jan > >