From patchwork Mon Feb 13 10:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Shihua X-Patchwork-Id: 5321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2275834wrn; Mon, 13 Feb 2023 02:47:22 -0800 (PST) X-Google-Smtp-Source: AK7set9n0ZLr7bnJ3xSec4E6tc2NDLzmNv3JXc18wQYp3XnvRRvZfHN6mVF/VexgiyqzeyDfvcmD X-Received: by 2002:a17:907:a095:b0:877:8ae7:2e44 with SMTP id hu21-20020a170907a09500b008778ae72e44mr26232244ejc.5.1676285241919; Mon, 13 Feb 2023 02:47:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676285241; cv=none; d=google.com; s=arc-20160816; b=ZG6jf7pO0uRPzQ8TDw2TDT98SgJsyW/gHqMcLpe9S3us/wL8eF74J4qb+mMFHg0ius pqEKxuQ6+pJ0HHqRErNyrJyoKjnBhEzTOSlGx+eylpKP4hoyI+gxOMpTXeGG4grw60Ns EWVyPqfpH/C25YbJrDdxlLRc8Py6Xk+vbo+0LGsy90q3GNsvxQD67xL1TqS4oJ4hlGBL l8lST2I8I0l6FipkbyQNwC7c4+xvMWMitxYaiIZBJfGiAOPk88uOv2UeXg0TflkQJCCx ulvUm4o2bbzkuclltsK5xyRdk+l7QfICnk2K4Nvv99JH9jMWDXy+4yaVjs0eiOulsjva 2W3g== 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=g1oY+wgXwmI8yniLRg8dG5Nh17lwVaYRQlgLP9cps1s=; b=OvculAhj/USiWAlePHJ7kQbiAMNJtg5peQ5J7qEZPVy/poQvIQl7mzogczDYDYeqSB O0ZFmk6EUeJwi1LOJMaNe4/WopSJu4QTdnWwnvHoXVLFXwuVdX5UrQrwaENhLKZ1WmlH AvIxaYkrCPnNecvtVJ7HgJAQGb7mZ5IVJHaWJr6xChGjPLMJ6jrwgwntrQXYteHPiRF0 guZ6L8+/h12reAEoJnRAhGtchfja3wdlP8XR2Q0z6WmHBECjM+pSZzFv7FkKpp3Xz2pO fVmjqL8cA0+7hh2nzEUgnRjOmXy9mskknNnND5a22I/pUoh7Hcdu1s/i77drrseCgqN9 2x5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s12-20020a170906220c00b00889c115cf70si16712988ejs.190.2023.02.13.02.47.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 02:47:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 D2D5E3889E2E for ; Mon, 13 Feb 2023 10:46:26 +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 1E2B9385ED4F for ; Mon, 13 Feb 2023 10:45:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E2B9385ED4F 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 qwCowAB3fc3gFOpjeCzlBA--.20197S2; Mon, 13 Feb 2023 18:45:53 +0800 (CST) From: Liao Shihua To: gcc-patches@gcc.gnu.org Cc: palmer@dabbelt.com, kito.cheng@gmail.com, jiawei@iscas.ac.cn, jeff@riscv.org, mjos@iki.fi, ben.marshall@pqshield.com, Liao Shihua Subject: [PATCH 0/5] RISC-V: Implement Scalar Cryptography Extension Date: Mon, 13 Feb 2023 18:45:33 +0800 Message-Id: <20230213104538.1287-1-shihua@iscas.ac.cn> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: qwCowAB3fc3gFOpjeCzlBA--.20197S2 X-Coremail-Antispam: 1UD129KBjvJXoWxJFykWFy3Kry3AF1fWry7GFg_yoW5Wr48pa 1UGrWFkry5JF9rGF1ftFy7Ka15uw4vgrW5uw1xXw1Iy3yftrWUtF1kKr1xAFW3JF48Kr1f ur4293W5uw12qFDanT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9G14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1ln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE 6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVWUJVW8JwAm72 CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7 MxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r 4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAF wI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20x vE14v26r4j6ryUMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v2 0xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxV W8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbpwZ7UUUUU== X-Originating-IP: [39.170.88.238] X-CM-SenderInfo: xvklx33d6l2u1dvotugofq/1tbiCQkBEWPqAkUu0wAAsj X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham 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?1757711623471685311?= X-GMAIL-MSGID: =?utf-8?q?1757712474002349184?= This patch implement RISC-V Scalar Cryptography extension. It includes machine descrption , intrinsic and testcase . 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 extensions Implement ZKSH and ZKSED extensions gcc/config.gcc | 2 +- gcc/config/riscv/bitmanip.md | 20 +- gcc/config/riscv/constraints.md | 8 + gcc/config/riscv/crypto.md | 437 ++++++++++++++++++ gcc/config/riscv/riscv-builtins.cc | 26 ++ gcc/config/riscv/riscv-crypto.def | 94 ++++ gcc/config/riscv/riscv-ftypes.def | 10 + gcc/config/riscv/riscv.md | 4 +- gcc/config/riscv/riscv_scalar_crypto.h | 218 +++++++++ gcc/testsuite/gcc.target/riscv/zbkb32.c | 36 ++ gcc/testsuite/gcc.target/riscv/zbkb64.c | 28 ++ gcc/testsuite/gcc.target/riscv/zbkc32.c | 18 + gcc/testsuite/gcc.target/riscv/zbkc64.c | 17 + gcc/testsuite/gcc.target/riscv/zbkx32.c | 19 + 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 | 29 ++ .../gcc.target/riscv/zknh-sha512-32.c | 43 ++ .../gcc.target/riscv/zknh-sha512-64.c | 31 ++ gcc/testsuite/gcc.target/riscv/zksed.c | 20 + gcc/testsuite/gcc.target/riscv/zksh.c | 19 + 24 files changed, 1187 insertions(+), 12 deletions(-) create mode 100644 gcc/config/riscv/crypto.md create mode 100644 gcc/config/riscv/riscv-crypto.def create mode 100644 gcc/config/riscv/riscv_scalar_crypto.h 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/zksed.c create mode 100644 gcc/testsuite/gcc.target/riscv/zksh.c