From patchwork Mon Feb 20 07:01:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Shihua X-Patchwork-Id: 5632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1231337wrn; Mon, 20 Feb 2023 02:27:23 -0800 (PST) X-Google-Smtp-Source: AK7set8rN2DHChQcTrwowcpIe+Wui1zRIqHQLPnx89P8bq0OF3qL6OQNYie1Nn9Qe90ExUwJuLX5 X-Received: by 2002:a50:ff03:0:b0:4ac:c12b:8ef2 with SMTP id a3-20020a50ff03000000b004acc12b8ef2mr17653edu.21.1676888843490; Mon, 20 Feb 2023 02:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676888843; cv=none; d=google.com; s=arc-20160816; b=OiB23oZrOfdj+7/mSj/PN/EX8SPBrmZt25j9413OFzvkIJEVewMolA+gPTKiFM6vbl 1qrNRrdM28AoIpTBj9xLT88hiK1/fjKgEpwQNoJDUs170XjENen/zu6cOCQeJyp+jxCr qa0gghhJr+HkeAUVTwnypizYL3kDZHufdjmtYgcSCosOYjWfn3Ls5hUPqnshJZ4WX3I9 Ob+n97RO3CnAxr5ekv/xh5mabFyEx8BhK+rn83lPiPaxve7gzu/Wy3JzKyZz0n8LDdf9 JDYNDnQ/YxKMmhNGETUtY4tckwR2jDD3pAiMasQfGbdMXkg2zGbX3iKlJhy02+x6R0RD bPdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dmarc-filter :delivered-to; bh=CPRvylW6swF3eaDR0cuBtYYXcm7EkchunLyO0zJNBQI=; b=sPQuNhIQp8IXx6oqP0t0Gery7PaC/n/ipyZqewfyOenM5oAP9P938xUOvioTJTAxEl f33icOy43Bd+F/pMJa1YGNz5GV7Y+MqbxAO8S0VwVxd3n1vaZyPzGUojlOAcICe2eqxZ qoOVKtIblgFrS1CkJFoGojRS1L0EsKs2KRoLLq2rvfynW63jPsU9ZhZGqkPV24hbddZs gEE2e3H5rHZiRYF03cCyhTv5OKFhqkRwxP/QkfYOYREAL45wYkyA0e9MvFZkP2tFUlkS 88avM0U1Nh5Pj5kPUAG2gRFcGWzhJNf8seijQM8eUS3Q2VIQVpbaD5jZVbwgE80tL67M 0SNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b19-20020aa7d493000000b004ab250bcee6si2100620edr.648.2023.02.20.02.27.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 02:27:23 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9A0D393FC3C for ; Mon, 20 Feb 2023 10:15:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cstnet.cn (smtp80.cstnet.cn [159.226.251.80]) by sourceware.org (Postfix) with ESMTP id 0A78B3858C20 for ; Mon, 20 Feb 2023 10:15:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A78B3858C20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost.localdomain (unknown [39.170.88.238]) by APP-01 (Coremail) with SMTP id qwCowABHoNfVGvNjlPdOBg--.59272S2; Mon, 20 Feb 2023 15:01:41 +0800 (CST) From: Liao Shihua To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, Liao Shihua Subject: [PATCH V3 0/5] RISC-V: Implement Scalar Cryptography Extension Date: Mon, 20 Feb 2023 15:01:20 +0800 Message-Id: <20230220070125.2291-1-shihua@iscas.ac.cn> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: qwCowABHoNfVGvNjlPdOBg--.59272S2 X-Coremail-Antispam: 1UD129KBjvJXoWxWFWUZF17Gr4DuF4kWFWxWFg_yoW5Cw4fpa 18GryFkr15JF97GF1ftFy7tF4Uuw4vgrW5uw1xXw1IyFWftrWUtFn7Kr1xJay3JF48Kr1f ur4293W5uw12qFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyv14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxAIw28IcxkI7VAKI48J MxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbWCJPUUUUU== X-Originating-IP: [39.170.88.238] X-CM-SenderInfo: xvklx33d6l2u1dvotugofq/1tbiCQYIEWPy5eOOigABsE X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758345395774120638?= X-GMAIL-MSGID: =?utf-8?q?1758345395774120638?= This series adds basic support for the Scalar Cryptography extensions: * Zbkb * Zbkc * Zbkx * Zknd * Zkne * Zknh * Zksed * Zksh The implementation follows the version Scalar Cryptography v1.0.0 of the specification, which can be found here: https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0-scalar It works by Wu Siyu and Liao Shihua . Liao Shihua (5): Add prototypes for RISC-V Crypto built-in functions Implement ZBKB, ZBKC and ZBKX extensions Implement ZKND and ZKNE extensions Implement ZKNH extension Implement ZKSH and ZKSED extensions gcc/config/riscv/bitmanip.md | 20 +- gcc/config/riscv/constraints.md | 8 + gcc/config/riscv/crypto.md | 435 ++++++++++++++++++ gcc/config/riscv/riscv-builtins.cc | 26 ++ gcc/config/riscv/riscv-ftypes.def | 10 + gcc/config/riscv/riscv-scalar-crypto.def | 94 ++++ gcc/config/riscv/riscv.md | 4 +- gcc/testsuite/gcc.target/riscv/zbkb32.c | 36 ++ gcc/testsuite/gcc.target/riscv/zbkb64.c | 28 ++ gcc/testsuite/gcc.target/riscv/zbkc32.c | 17 + gcc/testsuite/gcc.target/riscv/zbkc64.c | 17 + gcc/testsuite/gcc.target/riscv/zbkx32.c | 18 + gcc/testsuite/gcc.target/riscv/zbkx64.c | 18 + gcc/testsuite/gcc.target/riscv/zknd32.c | 18 + gcc/testsuite/gcc.target/riscv/zknd64.c | 36 ++ gcc/testsuite/gcc.target/riscv/zkne32.c | 18 + gcc/testsuite/gcc.target/riscv/zkne64.c | 30 ++ gcc/testsuite/gcc.target/riscv/zknh-sha256.c | 28 ++ .../gcc.target/riscv/zknh-sha512-32.c | 42 ++ .../gcc.target/riscv/zknh-sha512-64.c | 31 ++ gcc/testsuite/gcc.target/riscv/zksed32.c | 19 + gcc/testsuite/gcc.target/riscv/zksed64.c | 19 + gcc/testsuite/gcc.target/riscv/zksh32.c | 19 + gcc/testsuite/gcc.target/riscv/zksh64.c | 19 + 24 files changed, 999 insertions(+), 11 deletions(-) create mode 100644 gcc/config/riscv/crypto.md create mode 100644 gcc/config/riscv/riscv-scalar-crypto.def create mode 100644 gcc/testsuite/gcc.target/riscv/zbkb32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zbkb64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zbkc32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zbkc64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zbkx32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zbkx64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zknd32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zknd64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zkne32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zkne64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zknh-sha256.c create mode 100644 gcc/testsuite/gcc.target/riscv/zknh-sha512-32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zknh-sha512-64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zksed32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zksed64.c create mode 100644 gcc/testsuite/gcc.target/riscv/zksh32.c create mode 100644 gcc/testsuite/gcc.target/riscv/zksh64.c