From patchwork Thu Feb 16 07:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Shihua X-Patchwork-Id: 5492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp166152wrn; Wed, 15 Feb 2023 23:52:21 -0800 (PST) X-Google-Smtp-Source: AK7set9PMEUzbYazulwmUOz+dMUT8E1f30LYydmn3iH2oQrf0v30FZ/HQ/OQsLC44MEGt4e6NQKS X-Received: by 2002:a17:906:e24a:b0:8b0:7d05:7df6 with SMTP id gq10-20020a170906e24a00b008b07d057df6mr5647163ejb.53.1676533940927; Wed, 15 Feb 2023 23:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676533940; cv=none; d=google.com; s=arc-20160816; b=TAEZg5vWv4MbvoiXovlKX+Gpe5Kj+lf983VsjlP5rcgNvmbRuARcLiac9VQzNZHlwD W+RaxQxj7Dw/AV1/UzL3pUmP0PKOiibZiE5LtXBZJiRxQfJH/V7V+is1xritZFK4DaKh JdphzXUDzXfQfthuNPlSohs4S9KaJHyq95tAOYJZIw/EZA3ApF9F5L/ynNjkPwvQ3+lB U0A8oGqpJxJicbXdrcEHrIxrz1cn5tjUcuvaOqxzOjzekLQDilmrYG14IFbnMhfGc1Ew Oca6UtxL1eL6zc2zkia5CV6fwzGtV1K5WyffgtIsom/d/yEE9ICLsD5G564ZvelVQ+Hv 38mA== 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=Z2cNyp63piq8F6dp6G7SVSL2JNgxGRQMVeSSvifBcgI=; b=lrv+0RzXioMHWm873hP7UeRkStVAbHQcfDjr/uBaQ2IZCq7Js8Ti5RYFsMhiB+Ie0N VQHFU9Lz1lZDt0e/Tte6cTP+365ff8GZGWCer9AUTOcPQkJHWiWwgynGMh99quusO4Ax 69HF4HPPmIUe+p6DS+iSZ8CfK5o+ESxerbLMtuPJD9NbF5TTjU7hixdcCtbq3d+AXKtx 5jPXphtWAQ9J0vjl/+MNLrzqesmldcIeYlnYno1qcnwj0VwTkHTUuCCBHlfb1Mkq2BcK nR2OtM+PmtRRYxnJzrAKn3aHlG0IVRB1yLP/gjnOx5M/7buomKwV4yY3orQy4s5RMO/N AupQ== 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 kb17-20020a170907925100b008b1472d5b0bsi1390360ejb.66.2023.02.15.23.52.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 23:52:20 -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 CA6FB3887F79 for ; Thu, 16 Feb 2023 07:51:25 +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 B24EB3858C60 for ; Thu, 16 Feb 2023 07:50:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B24EB3858C60 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 qwCowAAXG0c54O1jP3dbBQ--.9892S2; Thu, 16 Feb 2023 15:50:18 +0800 (CST) From: Liao Shihua To: gcc-patches@gcc.gnu.org Cc: jiawei@iscas.ac.cn, kito.cheng@gmail.com, mjos@iki.fi, palmer@dabbelt.com, shiyulong@iscas.ac.cn, ben.marshall@pqshield.com, christoph.muellner@vrull.eu, Liao Shihua Subject: [PATCH V2 0/5] RISC-V: Implement Scalar Cryptography Extension Date: Thu, 16 Feb 2023 15:50:00 +0800 Message-Id: <20230216075005.2600-1-shihua@iscas.ac.cn> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: qwCowAAXG0c54O1jP3dbBQ--.9892S2 X-Coremail-Antispam: 1UD129KBjvJXoWxWFWUZF18Cry8try3Jr17Awb_yoW5Zry8pa 1rGrWFkFy5JF9rGr1ftFy7ta1Uuw4vgrW5uw1xJr1IyFWftrWDtFn7Kw1xAFW3JF48Grn3 ur4I93W5uw12qFDanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvj14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F 4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AK xVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8 JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUFg 4SDUUUU X-Originating-IP: [39.170.88.238] X-CM-SenderInfo: xvklx33d6l2u1dvotugofq/1tbiAw8EEWPt1f0fiwACsp X-Spam-Status: No, score=-6.5 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?1757973061888249615?= X-GMAIL-MSGID: =?utf-8?q?1757973253898744789?= 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, and the intrinsic of Scalar Cryptography extensions follows riscv-c-api which can be found here: https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0-scalar https://github.com/riscv-non-isa/riscv-c-api-doc/pull/31 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 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 | 435 ++++++++++++++++++ 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 | 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 | 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, 1183 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