[v2,3/3] RISC-V: Scalar crypto instruction and Entropy Source CSR testcases

Message ID 20211103015436.316363-4-jiawei@iscas.ac.cn
State New
Headers show
Series
  • RISC-V: Support Scalar Cryptography extension
Related show

Commit Message

jiawei Nov. 3, 2021, 1:54 a.m.
---
 gas/testsuite/gas/riscv/k-ext-64.d            | 47 +++++++++++++++++++
 gas/testsuite/gas/riscv/k-ext-64.s            | 38 +++++++++++++++
 gas/testsuite/gas/riscv/k-ext.d               | 44 +++++++++++++++++
 gas/testsuite/gas/riscv/k-ext.s               | 35 ++++++++++++++
 .../gas/riscv/priv-reg-version-1p10.d         |  1 +
 .../gas/riscv/priv-reg-version-1p11.d         |  1 +
 .../gas/riscv/priv-reg-version-1p9p1.d        |  1 +
 gas/testsuite/gas/riscv/priv-reg.s            |  4 ++
 8 files changed, 171 insertions(+)
 create mode 100644 gas/testsuite/gas/riscv/k-ext-64.d
 create mode 100644 gas/testsuite/gas/riscv/k-ext-64.s
 create mode 100644 gas/testsuite/gas/riscv/k-ext.d
 create mode 100644 gas/testsuite/gas/riscv/k-ext.s

Comments

Christoph Muellner Nov. 3, 2021, 10:38 p.m. | #1
On Wed, Nov 3, 2021 at 2:55 AM jiawei <jiawei@iscas.ac.cn> wrote:
>


Commit message is missing.

> ---

>  gas/testsuite/gas/riscv/k-ext-64.d            | 47 +++++++++++++++++++

>  gas/testsuite/gas/riscv/k-ext-64.s            | 38 +++++++++++++++

>  gas/testsuite/gas/riscv/k-ext.d               | 44 +++++++++++++++++

>  gas/testsuite/gas/riscv/k-ext.s               | 35 ++++++++++++++

>  .../gas/riscv/priv-reg-version-1p10.d         |  1 +

>  .../gas/riscv/priv-reg-version-1p11.d         |  1 +

>  .../gas/riscv/priv-reg-version-1p9p1.d        |  1 +

>  gas/testsuite/gas/riscv/priv-reg.s            |  4 ++

>  8 files changed, 171 insertions(+)

>  create mode 100644 gas/testsuite/gas/riscv/k-ext-64.d

>  create mode 100644 gas/testsuite/gas/riscv/k-ext-64.s

>  create mode 100644 gas/testsuite/gas/riscv/k-ext.d

>  create mode 100644 gas/testsuite/gas/riscv/k-ext.s

>

> diff --git a/gas/testsuite/gas/riscv/k-ext-64.d b/gas/testsuite/gas/riscv/k-ext-64.d

> new file mode 100644

> index 00000000000..06f47566ac8

> --- /dev/null

> +++ b/gas/testsuite/gas/riscv/k-ext-64.d

> @@ -0,0 +1,47 @@

> +#as: -march=rv64i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt


I would prefer to split the tests into one for each instruction extension group.
This ensures that we also test if the grouping is correct.
E.g. do zknd and zkne both really enable aes64ks1i and aes64ks2 for RV64?
A nice side-effect from splitting the tests would be to not have a "k-ext" file,
which looks incorrect because there is no K extension.

> +#source: k-ext-64.s

> +#objdump: -d

> +

> +.*:[   ]+file format .*

> +

> +

> +Disassembly of section .text:

> +

> +0+000 <target>:

> +[      ]+.*:[  ]+.*[   ]+ror[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+rol[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+rori[         ]+a0,a1,0x2

> +[      ]+.*:[  ]+.*[   ]+rorw[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+rolw[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+roriw[        ]+a0,a1,0x2

> +[      ]+.*:[  ]+.*[   ]+andn[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+orn[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xnor[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+pack[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+packh[        ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+packw[        ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+brev8[        ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+rev8[         ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+clmul[        ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+clmulh[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xperm4[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xperm8[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes64ds[      ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes64dsm[     ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes64im[      ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+aes64ks1i[    ]+a0,a1,0x4

> +[      ]+.*:[  ]+.*[   ]+aes64ks2[     ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes64es[      ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes64esm[     ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha256sig0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sig1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sum0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sum1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha512sig0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha512sig1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha512sum0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha512sum1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sm4ed[        ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+sm4ks[        ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+sm3p0[        ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sm3p1[        ]+a0,a0

> diff --git a/gas/testsuite/gas/riscv/k-ext-64.s b/gas/testsuite/gas/riscv/k-ext-64.s

> new file mode 100644

> index 00000000000..302b82ea005

> --- /dev/null

> +++ b/gas/testsuite/gas/riscv/k-ext-64.s

> @@ -0,0 +1,38 @@

> +target:

> +        ror     a0, a1, a2

> +        rol     a0, a1, a2

> +        rori    a0, a1, 2

> +        rorw    a0, a1, a2

> +        rolw    a0, a1, a2

> +        roriw   a0, a1, 2

> +        andn    a0, a1, a2

> +        orn     a0, a1, a2

> +        xnor    a0, a1, a2

> +        pack    a0, a1, a2

> +        packh   a0, a1, a2

> +        packw   a0, a1, a2

> +        brev8   a0, a0

> +        rev8    a0, a0

> +        clmul   a0, a1, a2

> +        clmulh  a0, a1, a2

> +        xperm4  a0, a1, a2

> +        xperm8  a0, a1, a2

> +        aes64ds     a0, a1, a2

> +        aes64dsm    a0, a1, a2

> +        aes64im     a0, a0

> +        aes64ks1i   a0, a1, 4

> +        aes64ks2    a0, a1, a2

> +        aes64es     a0, a1, a2

> +        aes64esm    a0, a1, a2

> +        sha256sig0  a0, a0

> +        sha256sig1  a0, a0

> +        sha256sum0  a0, a0

> +        sha256sum1  a0, a0

> +        sha512sig0  a0, a0

> +        sha512sig1  a0, a0

> +        sha512sum0  a0, a0

> +        sha512sum1  a0, a0

> +        sm4ed   a0, a1, a2, 2

> +        sm4ks   a0, a1, a2, 2

> +        sm3p0   a0, a0

> +        sm3p1   a0, a0

> diff --git a/gas/testsuite/gas/riscv/k-ext.d b/gas/testsuite/gas/riscv/k-ext.d

> new file mode 100644

> index 00000000000..3ba65aadc74

> --- /dev/null

> +++ b/gas/testsuite/gas/riscv/k-ext.d

> @@ -0,0 +1,44 @@

> +#as: -march=rv32i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt

> +#source: k-ext.s

> +#objdump: -d

> +

> +.*:[   ]+file format .*

> +

> +

> +Disassembly of section .text:

> +

> +0+000 <target>:

> +[      ]+.*:[  ]+.*[   ]+ror[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+rol[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+rori[         ]+a0,a1,0x2

> +[      ]+.*:[  ]+.*[   ]+andn[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+orn[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xnor[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+pack[         ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+packh[        ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+brev8[        ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+rev8[         ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+zip[  ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+unzip[        ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+clmul[        ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+clmulh[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xperm4[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+xperm8[       ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+aes32dsi[     ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+aes32dsmi[    ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+aes32esi[     ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+aes32esmi[    ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+sha256sig0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sig1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sum0[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha256sum1[   ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sha512sig0h[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha512sig0l[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha512sig1h[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha512sig1l[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha512sum0r[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sha512sum1r[  ]+a0,a1,a2

> +[      ]+.*:[  ]+.*[   ]+sm4ed[        ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+sm4ks[        ]+a0,a1,a2,0x2

> +[      ]+.*:[  ]+.*[   ]+sm3p0[        ]+a0,a0

> +[      ]+.*:[  ]+.*[   ]+sm3p1[        ]+a0,a0

> diff --git a/gas/testsuite/gas/riscv/k-ext.s b/gas/testsuite/gas/riscv/k-ext.s

> new file mode 100644

> index 00000000000..8eb27684710

> --- /dev/null

> +++ b/gas/testsuite/gas/riscv/k-ext.s

> @@ -0,0 +1,35 @@

> +target:

> +        ror     a0, a1, a2

> +        rol     a0, a1, a2

> +        rori    a0, a1, 2

> +        andn    a0, a1, a2

> +        orn     a0, a1, a2

> +        xnor    a0, a1, a2

> +        pack    a0, a1, a2

> +        packh   a0, a1, a2

> +        brev8   a0, a0

> +        rev8    a0, a0

> +        zip     a0, a0

> +        unzip   a0, a0

> +        clmul   a0, a1, a2

> +        clmulh  a0, a1, a2

> +        xperm4  a0, a1, a2

> +        xperm8  a0, a1, a2

> +        aes32dsi    a0, a1, a2, 2

> +        aes32dsmi   a0, a1, a2, 2

> +        aes32esi    a0, a1, a2, 2

> +        aes32esmi   a0, a1, a2, 2

> +        sha256sig0  a0, a0

> +        sha256sig1  a0, a0

> +        sha256sum0  a0, a0

> +        sha256sum1  a0, a0

> +        sha512sig0h    a0, a1, a2

> +        sha512sig0l    a0, a1, a2

> +        sha512sig1h    a0, a1, a2

> +        sha512sig1l    a0, a1, a2

> +        sha512sum0r    a0, a1, a2

> +        sha512sum1r    a0, a1, a2

> +        sm4ed   a0, a1, a2, 2

> +        sm4ks   a0, a1, a2, 2

> +        sm3p0   a0, a0

> +        sm3p1   a0, a0

> diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p10.d b/gas/testsuite/gas/riscv/priv-reg-version-1p10.d

> index 3ad8eebe851..78c683d3dea 100644

> --- a/gas/testsuite/gas/riscv/priv-reg-version-1p10.d

> +++ b/gas/testsuite/gas/riscv/priv-reg-version-1p10.d

> @@ -265,3 +265,4 @@ Disassembly of section .text:

>  [      ]+[0-9a-f]+:[   ]+7a102573[     ]+csrr[         ]+a0,tdata1

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

> +[      ]+[0-9a-f]+:[   ]+01502573[     ]+csrr[         ]+a0,seed

> diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p11.d b/gas/testsuite/gas/riscv/priv-reg-version-1p11.d

> index 5824bc5e1f6..6c1cc70479b 100644

> --- a/gas/testsuite/gas/riscv/priv-reg-version-1p11.d

> +++ b/gas/testsuite/gas/riscv/priv-reg-version-1p11.d

> @@ -265,3 +265,4 @@ Disassembly of section .text:

>  [      ]+[0-9a-f]+:[   ]+7a102573[     ]+csrr[         ]+a0,tdata1

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

> +[      ]+[0-9a-f]+:[   ]+01502573[     ]+csrr[         ]+a0,seed

> diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d b/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d

> index 569b9587e29..3d2ab74eb35 100644

> --- a/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d

> +++ b/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d

> @@ -265,3 +265,4 @@ Disassembly of section .text:

>  [      ]+[0-9a-f]+:[   ]+7a102573[     ]+csrr[         ]+a0,tdata1

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

>  [      ]+[0-9a-f]+:[   ]+7a302573[     ]+csrr[         ]+a0,tdata3

> +[      ]+[0-9a-f]+:[   ]+01502573[     ]+csrr[         ]+a0,seed

> diff --git a/gas/testsuite/gas/riscv/priv-reg.s b/gas/testsuite/gas/riscv/priv-reg.s

> index c40d28862b7..23245a7301e 100644

> --- a/gas/testsuite/gas/riscv/priv-reg.s

> +++ b/gas/testsuite/gas/riscv/priv-reg.s

> @@ -282,3 +282,7 @@

>         csr etrigger            # 0x7a1, alias to tdata1

>         csr textra32            # 0x7a3, alias to tdata3

>         csr textra64            # 0x7a3, alias to tdata3

> +

> +       # Scalar crypto

> +       csr seed                # 0x015, Entropy Source

> +

> \ No newline at end of file

>

Patch

diff --git a/gas/testsuite/gas/riscv/k-ext-64.d b/gas/testsuite/gas/riscv/k-ext-64.d
new file mode 100644
index 00000000000..06f47566ac8
--- /dev/null
+++ b/gas/testsuite/gas/riscv/k-ext-64.d
@@ -0,0 +1,47 @@ 
+#as: -march=rv64i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt
+#source: k-ext-64.s
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+.*:[ 	]+.*[ 	]+ror[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+rol[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+rori[ 	]+a0,a1,0x2
+[ 	]+.*:[ 	]+.*[ 	]+rorw[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+rolw[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+roriw[ 	]+a0,a1,0x2
+[ 	]+.*:[ 	]+.*[ 	]+andn[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+orn[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+xnor[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+pack[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+packh[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+packw[ 	]+a0,a1,a2
+[ 	]+.*:[ 	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*:[ 	]+.*[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/k-ext-64.s b/gas/testsuite/gas/riscv/k-ext-64.s
new file mode 100644
index 00000000000..302b82ea005
--- /dev/null
+++ b/gas/testsuite/gas/riscv/k-ext-64.s
@@ -0,0 +1,38 @@ 
+target:
+        ror     a0, a1, a2
+        rol     a0, a1, a2
+        rori    a0, a1, 2
+        rorw    a0, a1, a2
+        rolw    a0, a1, a2
+        roriw   a0, a1, 2
+        andn    a0, a1, a2
+        orn     a0, a1, a2
+        xnor    a0, a1, a2
+        pack    a0, a1, a2
+        packh   a0, a1, a2
+        packw   a0, a1, a2
+        brev8   a0, a0
+        rev8    a0, a0
+        clmul   a0, a1, a2
+        clmulh  a0, a1, a2
+        xperm4  a0, a1, a2
+        xperm8  a0, a1, a2
+        aes64ds     a0, a1, a2
+        aes64dsm    a0, a1, a2
+        aes64im     a0, a0
+        aes64ks1i   a0, a1, 4
+        aes64ks2    a0, a1, a2
+        aes64es     a0, a1, a2
+        aes64esm    a0, a1, a2
+        sha256sig0  a0, a0
+        sha256sig1  a0, a0
+        sha256sum0  a0, a0
+        sha256sum1  a0, a0
+        sha512sig0  a0, a0
+        sha512sig1  a0, a0
+        sha512sum0  a0, a0
+        sha512sum1  a0, a0
+        sm4ed   a0, a1, a2, 2
+        sm4ks   a0, a1, a2, 2
+        sm3p0   a0, a0
+        sm3p1   a0, a0
diff --git a/gas/testsuite/gas/riscv/k-ext.d b/gas/testsuite/gas/riscv/k-ext.d
new file mode 100644
index 00000000000..3ba65aadc74
--- /dev/null
+++ b/gas/testsuite/gas/riscv/k-ext.d
@@ -0,0 +1,44 @@ 
+#as: -march=rv32i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt
+#source: k-ext.s
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+.*:[ 	]+.*[ 	]+ror[ 	]+a0,a1,a2
+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+[ 	]+.*:[ 	]+.*[ 	]+sha512sig0l[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+sha512sig1h[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+sha512sig1l[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+sha512sum0r[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+sha512sum1r[ 	]+a0,a1,a2
+[ 	]+.*:[ 	]+.*[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
+[ 	]+.*:[ 	]+.*[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
+[ 	]+.*:[ 	]+.*[ 	]+sm3p0[ 	]+a0,a0
+[ 	]+.*:[ 	]+.*[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/k-ext.s b/gas/testsuite/gas/riscv/k-ext.s
new file mode 100644
index 00000000000..8eb27684710
--- /dev/null
+++ b/gas/testsuite/gas/riscv/k-ext.s
@@ -0,0 +1,35 @@ 
+target:
+        ror     a0, a1, a2
+        rol     a0, a1, a2
+        rori    a0, a1, 2
+        andn    a0, a1, a2
+        orn     a0, a1, a2
+        xnor    a0, a1, a2
+        pack    a0, a1, a2
+        packh   a0, a1, a2
+        brev8   a0, a0
+        rev8    a0, a0
+        zip     a0, a0
+        unzip   a0, a0
+        clmul   a0, a1, a2
+        clmulh  a0, a1, a2
+        xperm4  a0, a1, a2
+        xperm8  a0, a1, a2
+        aes32dsi    a0, a1, a2, 2
+        aes32dsmi   a0, a1, a2, 2
+        aes32esi    a0, a1, a2, 2
+        aes32esmi   a0, a1, a2, 2
+        sha256sig0  a0, a0
+        sha256sig1  a0, a0
+        sha256sum0  a0, a0
+        sha256sum1  a0, a0
+        sha512sig0h    a0, a1, a2
+        sha512sig0l    a0, a1, a2
+        sha512sig1h    a0, a1, a2
+        sha512sig1l    a0, a1, a2
+        sha512sum0r    a0, a1, a2
+        sha512sum1r    a0, a1, a2
+        sm4ed   a0, a1, a2, 2
+        sm4ks   a0, a1, a2, 2
+        sm3p0   a0, a0
+        sm3p1   a0, a0
diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p10.d b/gas/testsuite/gas/riscv/priv-reg-version-1p10.d
index 3ad8eebe851..78c683d3dea 100644
--- a/gas/testsuite/gas/riscv/priv-reg-version-1p10.d
+++ b/gas/testsuite/gas/riscv/priv-reg-version-1p10.d
@@ -265,3 +265,4 @@  Disassembly of section .text:
 [     	]+[0-9a-f]+:[  	]+7a102573[    	]+csrr[        	]+a0,tdata1
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
+[     	]+[0-9a-f]+:[  	]+01502573[    	]+csrr[        	]+a0,seed
diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p11.d b/gas/testsuite/gas/riscv/priv-reg-version-1p11.d
index 5824bc5e1f6..6c1cc70479b 100644
--- a/gas/testsuite/gas/riscv/priv-reg-version-1p11.d
+++ b/gas/testsuite/gas/riscv/priv-reg-version-1p11.d
@@ -265,3 +265,4 @@  Disassembly of section .text:
 [     	]+[0-9a-f]+:[  	]+7a102573[    	]+csrr[        	]+a0,tdata1
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
+[     	]+[0-9a-f]+:[  	]+01502573[    	]+csrr[        	]+a0,seed
diff --git a/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d b/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d
index 569b9587e29..3d2ab74eb35 100644
--- a/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/priv-reg-version-1p9p1.d
@@ -265,3 +265,4 @@  Disassembly of section .text:
 [     	]+[0-9a-f]+:[  	]+7a102573[    	]+csrr[        	]+a0,tdata1
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
 [     	]+[0-9a-f]+:[  	]+7a302573[    	]+csrr[        	]+a0,tdata3
+[     	]+[0-9a-f]+:[  	]+01502573[    	]+csrr[        	]+a0,seed
diff --git a/gas/testsuite/gas/riscv/priv-reg.s b/gas/testsuite/gas/riscv/priv-reg.s
index c40d28862b7..23245a7301e 100644
--- a/gas/testsuite/gas/riscv/priv-reg.s
+++ b/gas/testsuite/gas/riscv/priv-reg.s
@@ -282,3 +282,7 @@ 
 	csr etrigger		# 0x7a1, alias to tdata1
 	csr textra32		# 0x7a3, alias to tdata3
 	csr textra64		# 0x7a3, alias to tdata3
+
+	# Scalar crypto
+	csr seed		# 0x015, Entropy Source
+	
\ No newline at end of file