mbox series

[00/21] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc5

Message ID 20211031093445.1414518-1-siyu@isrc.iscas.ac.cn
Headers show
Series RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc5 | expand

Message

siyu@isrc.iscas.ac.cn Oct. 31, 2021, 9:34 a.m. UTC
From: SiYu Wu <siyu@isrc.iscas.ac.cn>

This patch add gcc backend support for RISC-V Scalar Cryptography 
Extension (k-ext), including machine description, builtins defines and 
testcases for each k-ext's subset.

A note about Zbkx: The Zbkx should be implemented in bitmanip's Zbp, but 
since zbp is not included in the bitmanip spec v1.0, and crypto's v1.0 
release will earlier than bitmanip's next release, so for now we 
implementing it here.

SiYu Wu (19):
  [crypto]: add machine description for Zknd and Zkne
  [crypto]: add builtins for Zknd and Zkne
  [crypto]: add testcases for Zknd and Zkne
  [crypto]: add machine description for Zknh
  [crypto]: add builtins for Zknh
  [crypto]: add testcases for Zknh
  [crypto]: add machine description for Zksed
  [crypto]: add builtins for Zksed
  [crypto]: add testcases for Zksed
  [crypto]: add machine description for Zksh
  [crypto]: add builtins for Zksh
  [crypto]: add testcases for Zksh
  [crypto]: add option defines for Zkr and Zkt
  [crypto]: add option defines for Zbkb, Zbkc and Zbkx
  [crypto]: add implied defines of Zk, Zkn and Zks
  change z* subset assert to allow "zk"
  [crypto]: add machine description for Zbkx
  [crypto]: add builtins for Zbkx
  [crypto]: add testcases for Zbkx

jiawei (1):
  Fix attribute bugs due to zicsr/zifencei

linsinan1995 (1):
  Fix riscv_expand_block_move

 gcc/common/config/riscv/riscv-common.c        |  39 ++-
 gcc/config/riscv/arch-canonicalize            |  18 +-
 gcc/config/riscv/crypto.md                    | 319 ++++++++++++++++++
 gcc/config/riscv/riscv-builtins-crypto.def    |  76 +++++
 gcc/config/riscv/riscv-builtins.c             |  25 ++
 gcc/config/riscv/riscv-ftypes.def             |   6 +
 gcc/config/riscv/riscv-opts.h                 |  21 ++
 gcc/config/riscv/riscv.c                      |   2 +-
 gcc/config/riscv/riscv.md                     |   4 +-
 gcc/config/riscv/riscv.opt                    |   3 +
 gcc/testsuite/gcc.target/riscv/Zbkx.c         |  17 +
 gcc/testsuite/gcc.target/riscv/Zknd-aes-01.c  |  15 +
 gcc/testsuite/gcc.target/riscv/Zknd-aes-02.c  |  21 ++
 gcc/testsuite/gcc.target/riscv/Zkne-aes-01.c  |  15 +
 gcc/testsuite/gcc.target/riscv/Zkne-aes-02.c  |  27 ++
 gcc/testsuite/gcc.target/riscv/Zknh-sha256.c  |  27 ++
 .../gcc.target/riscv/Zknh-sha512-01.c         |  40 +++
 .../gcc.target/riscv/Zknh-sha512-02.c         |  28 ++
 gcc/testsuite/gcc.target/riscv/Zksed-sm4.c    |  17 +
 gcc/testsuite/gcc.target/riscv/Zksh-sm3.c     |  15 +
 20 files changed, 730 insertions(+), 5 deletions(-)
 create mode 100644 gcc/config/riscv/crypto.md
 create mode 100644 gcc/config/riscv/riscv-builtins-crypto.def
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zbkx.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zknd-aes-01.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zknd-aes-02.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zkne-aes-01.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zkne-aes-02.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha256.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha512-01.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha512-02.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zksed-sm4.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/Zksh-sm3.c

Comments

Kito Cheng Nov. 2, 2021, 11:16 a.m. UTC | #1
Hi Si-Yu:

Thanks for your patch!

Here is a general comment for this patch-set, GCC require ChagneLog in
commit log, and seems like that is included in your commit log, you
can refer other commit log to see how changelog wrote.

Scalar cryptography extension seems not define builtin and intrinsic
within the spec, I would prefer add those builtin to
riscv-c-api-doc[1] before adding to GCC for make sure LLVM and GCC
toolchain has consistent interface, so I would like to merge arch
string related stuffs only first.

So could you send a V2 patchset without builtins and md changes?


[1] https://github.com/riscv-non-isa/riscv-c-api-doc/blob/master/riscv-c-api.md

Thanks!






On Sun, Oct 31, 2021 at 5:34 PM <siyu@isrc.iscas.ac.cn> wrote:
>
> From: SiYu Wu <siyu@isrc.iscas.ac.cn>
>
> This patch add gcc backend support for RISC-V Scalar Cryptography
> Extension (k-ext), including machine description, builtins defines and
> testcases for each k-ext's subset.
>
> A note about Zbkx: The Zbkx should be implemented in bitmanip's Zbp, but
> since zbp is not included in the bitmanip spec v1.0, and crypto's v1.0
> release will earlier than bitmanip's next release, so for now we
> implementing it here.
>
> SiYu Wu (19):
>   [crypto]: add machine description for Zknd and Zkne
>   [crypto]: add builtins for Zknd and Zkne
>   [crypto]: add testcases for Zknd and Zkne
>   [crypto]: add machine description for Zknh
>   [crypto]: add builtins for Zknh
>   [crypto]: add testcases for Zknh
>   [crypto]: add machine description for Zksed
>   [crypto]: add builtins for Zksed
>   [crypto]: add testcases for Zksed
>   [crypto]: add machine description for Zksh
>   [crypto]: add builtins for Zksh
>   [crypto]: add testcases for Zksh
>   [crypto]: add option defines for Zkr and Zkt
>   [crypto]: add option defines for Zbkb, Zbkc and Zbkx
>   [crypto]: add implied defines of Zk, Zkn and Zks
>   change z* subset assert to allow "zk"
>   [crypto]: add machine description for Zbkx
>   [crypto]: add builtins for Zbkx
>   [crypto]: add testcases for Zbkx
>
> jiawei (1):
>   Fix attribute bugs due to zicsr/zifencei
>
> linsinan1995 (1):
>   Fix riscv_expand_block_move
>
>  gcc/common/config/riscv/riscv-common.c        |  39 ++-
>  gcc/config/riscv/arch-canonicalize            |  18 +-
>  gcc/config/riscv/crypto.md                    | 319 ++++++++++++++++++
>  gcc/config/riscv/riscv-builtins-crypto.def    |  76 +++++
>  gcc/config/riscv/riscv-builtins.c             |  25 ++
>  gcc/config/riscv/riscv-ftypes.def             |   6 +
>  gcc/config/riscv/riscv-opts.h                 |  21 ++
>  gcc/config/riscv/riscv.c                      |   2 +-
>  gcc/config/riscv/riscv.md                     |   4 +-
>  gcc/config/riscv/riscv.opt                    |   3 +
>  gcc/testsuite/gcc.target/riscv/Zbkx.c         |  17 +
>  gcc/testsuite/gcc.target/riscv/Zknd-aes-01.c  |  15 +
>  gcc/testsuite/gcc.target/riscv/Zknd-aes-02.c  |  21 ++
>  gcc/testsuite/gcc.target/riscv/Zkne-aes-01.c  |  15 +
>  gcc/testsuite/gcc.target/riscv/Zkne-aes-02.c  |  27 ++
>  gcc/testsuite/gcc.target/riscv/Zknh-sha256.c  |  27 ++
>  .../gcc.target/riscv/Zknh-sha512-01.c         |  40 +++
>  .../gcc.target/riscv/Zknh-sha512-02.c         |  28 ++
>  gcc/testsuite/gcc.target/riscv/Zksed-sm4.c    |  17 +
>  gcc/testsuite/gcc.target/riscv/Zksh-sm3.c     |  15 +
>  20 files changed, 730 insertions(+), 5 deletions(-)
>  create mode 100644 gcc/config/riscv/crypto.md
>  create mode 100644 gcc/config/riscv/riscv-builtins-crypto.def
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zbkx.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zknd-aes-01.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zknd-aes-02.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zkne-aes-01.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zkne-aes-02.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha256.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha512-01.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zknh-sha512-02.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zksed-sm4.c
>  create mode 100644 gcc/testsuite/gcc.target/riscv/Zksh-sm3.c
>
> --
> 2.25.1
>