[PATCH][Backport][GCC13] RISC-V: Fix missing boolean_expression in zmmul extension

2024-10-21 Thread Liao Shihua
This patch has been merged in GCC-14 but it needs to be added into GCC-13 as well. Missing boolean_expression TARGET_ZMMUL in riscv_rtx_costs() cause different instructions when multiplying an integer with a constant. ( https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1482 ) int foo

Re: [PATCH] RISC-V: Clarify that Vector Crypto Extensions require Vector Extensions[PR116150]

2024-08-05 Thread Liao Shihua
在 2024/8/6 12:34, Jeff Law 写道: On 8/5/24 10:23 AM, Patrick O'Neill wrote: On 8/5/24 01:23, Liao Shihua wrote: PR 116150: Zvk* and Zvb* extensions requires v or zve* extension, but on gcc v is implied. gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Remove

[PATCH] RISC-V: Clarify that Vector Crypto Extensions require Vector Extensions[PR116150]

2024-08-05 Thread Liao Shihua
PR 116150: Zvk* and Zvb* extensions requires v or zve* extension, but on gcc v is implied. gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Removed the zvk extension's implicit expansion of v extension. * config/riscv/arch-canonicalize: Ditto. * config/ris

[PATCH V2] RISC-V: Fix missing boolean_expression in zmmul extension

2024-05-23 Thread Liao Shihua
Update v1->v2 Add testcase for this patch. Missing boolean_expression TARGET_ZMMUL in riscv_rtx_costs() cause different instructions when multiplying an integer with a constant. ( https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1482 ) int foo(int *ib) { *ib = *ib * 33938;

[PATCH] RISC-V: Fix missing boolean_expression in zmmul extension

2024-05-23 Thread Liao Shihua
Missing boolean_expression TARGET_ZMMUL in riscv_rtx_costs() casuse different instructions when multiplying an integer with a constant. ( https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1482 ) int foo(int *ib) { *ib = *ib * 33938; return 0; } rv64im: lw a4,0(a1)

[PATCH v4 3/3] RISC-V: Add C intrinsic for Scalar Bitmanip Extension

2024-01-15 Thread Liao Shihua
This patch adds C intrinsics for Bitmanip Extension. RISCV_BUILTIN_NO_PREFIX is a new riscv_builtin_description like RISCV_BUILTIN. But it uses CODE_FOR_##INSN rather than CODE_FOR_riscv_##INSN. Changed orcb, clmul, brev8 pattern's mode form X to GPR because orcbsi, clmul_si, brev8_si are both in

[PATCH v4 2/3] RISC-V: Add C intrinsic for Scalar Crypto Extension

2024-01-15 Thread Liao Shihua
This patch adds C intrinsics for Scalar Crypto Extension. gcc/ChangeLog: * config.gcc: Include riscv_crypto.h. * config/riscv/riscv_crypto.h: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/scalar_crypto_intrinsic-32.c: New test. * gcc.target/riscv/scalar_c

[PATCH v4 1/3] RISC-V: Remove the Scalar Bitmanip and Crypto Built-In function testsuites

2024-01-15 Thread Liao Shihua
The serials patch provides a mapping from the RV intrinsics to the builtin names. There are some duplicates testsuites between intrinsic and built-in function. Remove the Scalar Bitmanip and Scalar Crypto Built-In function testsuites that will be included in the intrinsic functions. gcc/testsuite

[PATCH v4 0/3] RISC-V: Add intrinsics for Bitmanip and Scalar Crypto extensions

2024-01-15 Thread Liao Shihua
in and intrinsic. 4. Typo fix. Update v1 -> v2: 1. Rename *_intrinsic-* to *_intrinsic-XLEN. 2. Typo fix. 3. Intrinsics with immediate arguments will use marcos at O0 . It's a little patch add just provides a mapping from the RV intrinsics to the builtin names within GCC.

[PATCH V3 3/3] RISC-V: Add C intrinsic for Scalar Bitmanip Extension

2023-12-25 Thread Liao Shihua
This patch adds C intrinsics for Bitmanip Extension. RISCV_BUILTIN_NO_PREFIX is a new riscv_builtin_description like RISCV_BUILTIN. But it uses CODE_FOR_##INSN rather than CODE_FOR_riscv_##INSN. Changed orcb, clmul, brev8 pattern's mode form X to GPR because orcbsi, clmul_si, brev8_si are both in

[PATCH V3 2/3] RISC-V: Add C intrinsic for Scalar Crypto Extension

2023-12-25 Thread Liao Shihua
This patch adds C intrinsics for Scalar Crypto Extension. gcc/ChangeLog: * config.gcc: Include riscv_crypto.h. * config/riscv/riscv_crypto.h: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/scalar_crypto_intrinsic-32.c: New test. * gcc.target/riscv/scalar_c

[PATCH V3 0/3] RISC-V: Add intrinsics for Bitmanip and Scalar Crypto extensions

2023-12-25 Thread Liao Shihua
s with immediate arguments will use marcos at O0 . It's a little patch add just provides a mapping from the RV intrinsics to the builtin names within GCC. Liao Shihua (3): RISC-V: Remove the Scalar Bitmanip and Crypto Built-In function testsuites RISC-V: Add C intrinsic for Scalar Crypt

[PATCH V3 1/3] RISC-V: Remove the Scalar Bitmanip and Crypto Built-In function testsuites

2023-12-25 Thread Liao Shihua
The serials patch provides a mapping from the RV intrinsics to the builtin names. There are some duplicates testsuites between intrinsic and built-in function. Remove the Scalar Bitmanip and Scalar Crypto Built-In function testsuites that will be included in the intrinsic functions. gcc/testsuit

Re: [PATCH] RISC-V: fix scalar crypto pattern

2023-12-14 Thread Liao Shihua
e: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/622233.html No problem. And I would tend to remove the D03 constraint if we used const_0_3_operand. BR Liao  Shihua

[PATCH] RISC-V: fix scalar crypto pattern

2023-12-13 Thread Liao Shihua
In Scalar Crypto Built-In functions, some require immediate parameters, But register_operand are incorrectly used in the pattern. E.g.: __builtin_riscv_aes64ks1i(rs1,1) Before: li a5,1 aes64ks1i a0,a0,a5 Assembler messages: Error: instruction aes64ks1i requires

[PATCH V2 2/2]RISC-V: Add C intrinsics of Bitmanip Extension

2023-12-07 Thread Liao Shihua
This patch adds C intrinsics for Bitmanip Extension. RISCV_BUILTIN_NO_PREFIX is a new riscv_builtin_description like RISCV_BUILTIN. But it uses CODE_FOR_##INSN rather than CODE_FOR_riscv_##INSN. gcc/ChangeLog: * config.gcc: Add riscv_bitmanip.h * config/riscv/riscv-builtins.cc (AV

[PATCH V2 1/2] RISC-V: Add C intrinsics of Scalar Crypto Extension

2023-12-07 Thread Liao Shihua
This patch adds C intrinsics for Scalar Crypto Extension. gcc/ChangeLog: * config.gcc: Add riscv_crypto.h. * config/riscv/riscv_crypto.h: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/scalar_crypto_intrinsic-32.c: New test. * gcc.target/riscv/scalar_crypt

[PATCH V2 0/2] RISC-V: Add intrinsics for Bitmanip and Scalar Crypto extensions

2023-12-07 Thread Liao Shihua
m the RV intrinsics to the builtin names within GCC. Liao Shihua (2): Add C intrinsics of Scalar Crypto Extension Add C intrinsics of Bitmanip Extension gcc/config.gcc| 2 +- gcc/config/riscv/riscv-builtins.cc| 22 ++ gcc/config/riscv/riscv-ft

[PATCH 2/2] RISC-V: Add C intrinsics of Bitmanip Extension

2023-12-05 Thread Liao Shihua
This patch adds C intrinsics for Bitmanip Extension. RISCV_BUILTIN_NO_PREFIX is a new riscv_builtin_description like RISCV_BUILTIN. But it uses CODE_FOR_##INSN rather than CODE_FOR_riscv_##INSN. Some of the instructions are different to spec, see https://github.com/riscv-non-isa/riscv-c-api-doc/

[PATCH 1/2] RISC-V: Add C intrinsics of Scalar Crypto Extension

2023-12-05 Thread Liao Shihua
This patch adds C intrinsics for Scalar Crypto Extension. gcc/ChangeLog: * config.gcc: Add riscv_crypto.h. * config/riscv/riscv_crypto.h: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/scalar_crypto_intrinsic-1.c: New test. * gcc.target/riscv/scalar_cryp

[PATCH 0/2] RISC-V: Add intrinsics for Bitmanip and Scalar Crypto extensions.

2023-12-05 Thread Liao Shihua
It's a little patch add just provides a mapping from the RV intrinsics to the builtin names within GCC. Liao Shihua (2): Add C intrinsics of Scalar Crypto Extension Add C intrinsics of Bitmanip Extension gcc/config.gcc| 2 +- gcc/config/riscv/

Re: [PATCH] Add C intrinsics for scalar crypto extension

2023-11-29 Thread Liao Shihua
在 2023/11/29 23:03, Christoph Müllner 写道: On Mon, Nov 27, 2023 at 9:36 AM Liao Shihua wrote: This patch add C intrinsics for scalar crypto extension. Because of riscv-c-api (https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44/files) includes zbkb/zbkc/zbkx's intrinsics i

[PATCH] Add C intrinsics for scalar crypto extension

2023-11-27 Thread Liao Shihua
This patch add C intrinsics for scalar crypto extension. Because of riscv-c-api (https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44/files) includes zbkb/zbkc/zbkx's intrinsics in bit manipulation extension, this patch only support zkn*/zks*'s intrinsics. gcc/ChangeLog: * config.g

[PATCH] Add bfloat16_t support for riscv

2023-06-15 Thread Liao Shihua
x86_64/i686/AArch64 has for a few months working std::bfloat16_t support, __bf16 there is no longer a storage only type, but can be used for arithmetics and is supported in libgcc and libstdc++. The patch adds similar support for RISC-V. __bf16 has been merged in psABI. The c

Re: [RFC] RISC-V: Support risc-v bfloat16 This patch support bfloat16 in riscv like x86_64 and arm.

2023-06-01 Thread Liao Shihua
upport bfloat16_t in RISC-V port, but Zfbf extension's patch will be sent after it released. Liao Shihua 在 2023/6/1 14:51, Jin Ma 写道: hi, Are there any new developments about Zfb? Are there any plans to implement the Zvfbfmin and Zvfbfwma expansion? I see that Zfb is being reviewed in llvm, mayb

Re: [RFC V2] RISC-V : Support rv64 ilp32

2023-05-19 Thread Liao Shihua
ble? Oh, I was negligent and will make improvements in the next patch. Best Regards Liao Shihua

[RFC V2] RISC-V : Support rv64 ilp32

2023-05-18 Thread Liao Shihua
This patch support ilp32 on rv64. It remove option check when -march=rv64* -mabi=ilp32. And replace XLEN_SPEC in LINK_SPEC by ABI_LEN_SPEC. In addition, it some machine descriptions. The series kernel support in this link. https://lore.kernel.org/linux-riscv/20230518131013.3366406-1-guo...@kern

[RFC] RISC-V: Support risc-v bfloat16 This patch support bfloat16 in riscv like x86_64 and arm.

2023-03-07 Thread Liao Shihua
According to https://github.com/riscv/riscv-bfloat16 , zfbfmin extension depends on zfh/zfhmin extension. According to the discussion https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/367, this use __bf16 and use DF16b in riscv_mangle_type like x86. gcc\ChangeLog: * com

[PATCH V3 4/5] RISC-V: Implement ZKNH extension

2023-02-20 Thread Liao Shihua
This patch supports Zknh extension. It includes instruction's machine description and built-in funtions. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sha256sig0_): Add ZKNH's instructions. (riscv_sha256sig1_): (riscv_sha256sum0_): (riscv_sha256sum1_):

[PATCH V3 2/5] RISC-V: Implement ZBKB, ZBKC and ZBKX extensions

2023-02-20 Thread Liao Shihua
This patch supports Zkbk, Zbkc and Zkbx extension. It includes instruction's machine description and built-in funtions. It is worth mentioning that this patch only adds instructions in Zbkb but no longer in Zbb. If any instructions both in Zbb and Zbkb, they will be generated by code generator

[PATCH V3 3/5] RISC-V: Implement ZKND and ZKNE extensions

2023-02-20 Thread Liao Shihua
This patch supports Zkne and Zknd extension. It includes instruction's machine description and built-in funtions. gcc/ChangeLog: * config/riscv/constraints.md (D03): Add constants of bs and rnum. (DsA): * config/riscv/crypto.md (riscv_aes32dsi): Add ZKND's and ZKNE's in

[PATCH V3 1/5] RISC-V: Add prototypes for RISC-V Crypto built-in functions

2023-02-20 Thread Liao Shihua
This patch adds prototypes for RISC-V Crypto built-in functions. gcc/ChangeLog: * config/riscv/riscv-builtins.cc (RISCV_FTYPE_NAME2): (RISCV_FTYPE_NAME3): (RISCV_ATYPE_QI): (RISCV_ATYPE_HI): (RISCV_FTYPE_ATYPES2): (RISCV_FTYPE_ATYPES3): * co

[PATCH V3 0/5] RISC-V: Implement Scalar Cryptography Extension

2023-02-20 Thread Liao Shihua
/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

[PATCH V3 5/5] RISC-V: Implement ZKSH and ZKSED extensions

2023-02-20 Thread Liao Shihua
This patch supports Zksh and Zksed extension. It includes instruction's machine description and built-in funtions. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sm3p0_): Add ZKSED's and ZKSH's instructions. (riscv_sm3p1_): (riscv_sm4ed_): (riscv_sm4ks_):

[PATCH V2 2/5] Implement ZBKB, ZBKC and ZBKX extensions

2023-02-15 Thread Liao Shihua
This patch support Zkbk, Zbkc and Zkbx extension. It includes instruction's machine description, built-in funtion, and intrinsics. It is worth mentioning that this patch only adds instructions in Zbkb but no longer in Zbb. If any instructions both in Zbb and Zbkb, they will be generated by code

[PATCH V2 4/5] Implement ZKNH extensions

2023-02-15 Thread Liao Shihua
This patch support Zknh extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sha256sig0_):Add ZKNH's instructions. (riscv_sha256sig1_): Likewise. (riscv_sha256sum0_): Likewise.

[PATCH V2 3/5] Implement ZKND and ZKNE extensions

2023-02-15 Thread Liao Shihua
This patch support Zkne and Zknd extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/constraints.md (D03): New constraints of bs. (DsA):New constraints of rnum. * config/riscv/crypto.md (riscv_aes32ds

[PATCH V2 0/5] RISC-V: Implement Scalar Cryptography Extension

2023-02-15 Thread Liao Shihua
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

[PATCH V2 5/5] Implement ZKSH and ZKSED extensions

2023-02-15 Thread Liao Shihua
This patch support Zksh and Zksed extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sm3p0_): Add ZKSH's and ZKSED's instructions. (riscv_sm3p1_): Likewise. (riscv_sm4ed_): Likewise

[PATCH V2 1/5] Add prototypes for RISC-V Crypto built-in functions

2023-02-15 Thread Liao Shihua
gcc/ChangeLog: * config/riscv/riscv-builtins.cc (RISCV_FTYPE_NAME2): New enumeration identifier. (RISCV_FTYPE_NAME3): Likewise. (RISCV_ATYPE_QI): New Argument types. (RISCV_ATYPE_HI): Likewise. (RISCV_FTYPE_ATYPES2): New RISCV_ATYPE. (RISCV_FTYPE_AT

[PATCH V2 2/5] Implement ZBKB, ZBKC and ZBKX extensions

2023-02-15 Thread Liao Shihua
This patch support Zkbk, Zbkc and Zkbx extension. It includes instruction's machine description, built-in funtion, and intrinsics. It is worth mentioning that this patch only adds instructions in Zbkb but no longer in Zbb. If any instructions both in Zbb and Zbkb, they will be generated by code

[PATCH V2 4/5] Implement ZKNH extensions

2023-02-15 Thread Liao Shihua
This patch support Zknh extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sha256sig0_):Add ZKNH's instructions. (riscv_sha256sig1_): Likewise. (riscv_sha256sum0_): Likewise.

[PATCH V2 0/5] RISC-V: Implement Scalar Cryptography Extension

2023-02-15 Thread Liao Shihua
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

[PATCH V2 5/5] Implement ZKSH and ZKSED extensions

2023-02-15 Thread Liao Shihua
This patch support Zksh and Zksed extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sm3p0_): Add ZKSH's and ZKSED's instructions. (riscv_sm3p1_): Likewise. (riscv_sm4ed_): Likewise

[PATCH V2 3/5] Implement ZKND and ZKNE extensions

2023-02-15 Thread Liao Shihua
This patch support Zkne and Zknd extension. It includes instruction's machine description, built-in funtion, and intrinsics. gcc/ChangeLog: * config/riscv/constraints.md (D03): New constraints of bs. (DsA):New constraints of rnum. * config/riscv/crypto.md (riscv_aes32ds

[PATCH 1/5] Add prototypes for RISC-V Crypto built-in functions

2023-02-15 Thread Liao Shihua
Co-Authored-By: SiYu Wu --- gcc/config/riscv/riscv-builtins.cc | 8 gcc/config/riscv/riscv-ftypes.def | 10 ++ 2 files changed, 18 insertions(+) diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc index 25ca407f9a9..ded91e17554 100644 --- a/gcc

[PATCH 2/5] RISC-V: Implement ZBKB, ZBKC and ZBKX extensions

2023-02-13 Thread Liao Shihua
Implement ZBKB, ZBKC and ZBKX extensions. ZBKB is Bitmanip instructions for Cryptography. ZBKC is Carry-less multiply instructions. ZBKX is Crossbar permutation instructions. Only add Machine description and intrinsics of these instructions which are not defined in the first Bitman

[PATCH 3/5] RISC-V: Implement ZKND and ZKNE extensions

2023-02-13 Thread Liao Shihua
Implement ZKND and ZKNE extensions. ZKND is NIST Suite: AES Decryption. ZKNE is NIST Suite: AES Encryption. gcc/ChangeLog: * config/riscv/constraints.md (D03): New constraints of bs. (DsA):New constraints of rnum. * config/riscv/crypto.md (riscv_aes

[PATCH 5/5] RISC-V: Implement ZKSH and ZKSED extensions

2023-02-13 Thread Liao Shihua
Implement ZKSH and ZKSED extensions. ZKSH is ShangMi Suite: SM3 Hash Function Instructions. ZKSED is ShangMi Suite: SM4 Block Cipher Instructions. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sm3p0_): Add ZKSH's and ZKSED's instructions. (riscv_sm3p1_): Like

[PATCH 1/5] RISC-V: Add prototypes for RISC-V Crypto built-in functions

2023-02-13 Thread Liao Shihua
Add prototypes for RISC-V Crypto built-in functions . gcc/ChangeLog: * config/riscv/riscv-builtins.cc (RISCV_FTYPE_NAME2): New enumeration identifier. (RISCV_FTYPE_NAME3): Likewise. (RISCV_ATYPE_QI): New Argument types. (RISCV_ATYPE_HI): Likewise. (RIS

[PATCH 4/5] RISC-V: Implement ZKNH extensions

2023-02-13 Thread Liao Shihua
Implement ZKNH extensions. ZKNH is NIST Suite: Hash Function Instructions. gcc/ChangeLog: * config/riscv/crypto.md (riscv_sha256sig0_):Add ZKNH's instructions. (riscv_sha256sig1_): Likewise. (riscv_sha256sum0_): Likewise. (riscv_sha256sum1_): Likewise.

[PATCH 0/5] RISC-V: Implement Scalar Cryptography Extension

2023-02-13 Thread Liao Shihua
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

[PATCH 0/5] RISC-V: Implement Scalar Cryptography Extension

2023-02-13 Thread Liao Shihua
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

Re: [RFC]RISC-V: Support RV64-ILP32

2022-12-27 Thread Liao Shihua
could easier test that? On Wed, Dec 28, 2022 at 2:25 AM Palmer Dabbelt wrote: On Tue, 27 Dec 2022 10:24:10 PST (-0800), gcc-patches@gcc.gnu.org wrote: On 12/12/22 23:49, shi...@iscas.ac.cn wrote: From: Liao Shihua This patch support rv64 insn in ilp32 ABI. It was inspired by aarch64