public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6
@ 2021-11-22  8:19 siyu
  2021-11-22  8:19 ` [PATCH v2 1/2] RISC-V: Add option defines for Scalar Cryptography siyu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: siyu @ 2021-11-22  8:19 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, jimw, cmuellner, palmer, andrew, lazyparser, jiawei,
	ben.marshall, mjos, Richard.Newell, SiYu Wu

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.

Version logs:

v2: As Kito mentions, now this patch only includes the arch string related 
stuff, the builtins and md changes is not included, waiting for the builtin
and intrinsic added to the spec. Also removed the unnecessary patches and add
Changelogs.


SiYu Wu (2):
  RISC-V: Add option defines for Scalar Cryptography
  RISC-V: Add implied defines of Zk, Zkn and Zks

 gcc/common/config/riscv/riscv-common.c | 38 +++++++++++++++++++++++++-
 gcc/config/riscv/arch-canonicalize     | 16 ++++++++++-
 gcc/config/riscv/riscv-opts.h          | 22 +++++++++++++++
 gcc/config/riscv/riscv.opt             |  3 ++
 4 files changed, 77 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] RISC-V: Add option defines for Scalar Cryptography
  2021-11-22  8:19 [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 siyu
@ 2021-11-22  8:19 ` siyu
  2021-11-22  8:19 ` [PATCH v2 2/2] RISC-V: Add implied defines of Zk, Zkn and Zks siyu
  2021-11-24  3:22 ` [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 Palmer Dabbelt
  2 siblings, 0 replies; 7+ messages in thread
From: siyu @ 2021-11-22  8:19 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, jimw, cmuellner, palmer, andrew, lazyparser, jiawei,
	ben.marshall, mjos, Richard.Newell, SiYu Wu

From: SiYu Wu <siyu@isrc.iscas.ac.cn>

gcc/ChangeLog:

2021-11-21  SiYu Wu  <siyu@isrc.iscas.ac.cn>

	* common/config/riscv/riscv-common.c (riscv_ext_version_table):
	Add zbk* and zk*.
	* config/riscv/riscv-opts.h (MASK_ZBKB): New.
	(MASK_ZBKC): Ditto.
	(MASK_ZBKX): Ditto.
	(MASK_ZKNE): Ditto.
	(MASK_ZKND): Ditto.
	(MASK_ZKNH): Ditto.
	(MASK_ZKR): Ditto.
	(MASK_ZKSED): Ditto.
	(MASK_ZKSH): Ditto.
	(MASK_ZKT): Ditto.
	(TARGET_ZBKB): Ditto.
	(TARGET_ZBKC): Ditto.
	(TARGET_ZBKX): Ditto.
	(TARGET_ZKNE): Ditto.
	(TARGET_ZKND): Ditto.
	(TARGET_ZKNH): Ditto.
	(TARGET_ZKR): Ditto.
	(TARGET_ZKSED): Ditto.
	(TARGET_ZKSH): Ditto.
	(TARGET_ZKT): Ditto.
	* config/riscv/riscv.opt (riscv_zk_subext): New.
---
 gcc/common/config/riscv/riscv-common.c | 22 ++++++++++++++++++++++
 gcc/config/riscv/riscv-opts.h          | 22 ++++++++++++++++++++++
 gcc/config/riscv/riscv.opt             |  3 +++
 3 files changed, 47 insertions(+)

diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c
index b8dd0aeac3e..14dc6057ecd 100644
--- a/gcc/common/config/riscv/riscv-common.c
+++ b/gcc/common/config/riscv/riscv-common.c
@@ -106,6 +106,17 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
   {"zbc", ISA_SPEC_CLASS_NONE, 1, 0},
   {"zbs", ISA_SPEC_CLASS_NONE, 1, 0},
 
+  {"zbkb",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zbkc",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zbkx",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zkne",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zknd",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zknh",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zkr",   ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zksed", ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zksh",  ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zkt",   ISA_SPEC_CLASS_NONE, 1, 0},
+
   /* Terminate the list.  */
   {NULL, ISA_SPEC_CLASS_NONE, 0, 0}
 };
@@ -915,6 +926,17 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
   {"zbc",    &gcc_options::x_riscv_zb_subext, MASK_ZBC},
   {"zbs",    &gcc_options::x_riscv_zb_subext, MASK_ZBS},
 
+  {"zbkb",   &gcc_options::x_riscv_zk_subext, MASK_ZBKB},
+  {"zbkc",   &gcc_options::x_riscv_zk_subext, MASK_ZBKC},
+  {"zbkx",   &gcc_options::x_riscv_zk_subext, MASK_ZBKX},
+  {"zknd",   &gcc_options::x_riscv_zk_subext, MASK_ZKND},
+  {"zkne",   &gcc_options::x_riscv_zk_subext, MASK_ZKNE},
+  {"zknh",   &gcc_options::x_riscv_zk_subext, MASK_ZKNH},
+  {"zkr",    &gcc_options::x_riscv_zk_subext, MASK_ZKR},
+  {"zksed",  &gcc_options::x_riscv_zk_subext, MASK_ZKSED},
+  {"zksh",   &gcc_options::x_riscv_zk_subext, MASK_ZKSH},
+  {"zkt",    &gcc_options::x_riscv_zk_subext, MASK_ZKT},
+
   {NULL, NULL, 0}
 };
 
diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
index 2efc4b80f1f..f65ff678811 100644
--- a/gcc/config/riscv/riscv-opts.h
+++ b/gcc/config/riscv/riscv-opts.h
@@ -83,4 +83,26 @@ enum stack_protector_guard {
 #define TARGET_ZBC    ((riscv_zb_subext & MASK_ZBC) != 0)
 #define TARGET_ZBS    ((riscv_zb_subext & MASK_ZBS) != 0)
 
+#define MASK_ZBKB     (1 << 0)
+#define MASK_ZBKC     (1 << 1)
+#define MASK_ZBKX     (1 << 2)
+#define MASK_ZKNE     (1 << 3)
+#define MASK_ZKND     (1 << 4)
+#define MASK_ZKNH     (1 << 5)
+#define MASK_ZKR      (1 << 6)
+#define MASK_ZKSED    (1 << 7)
+#define MASK_ZKSH     (1 << 8)
+#define MASK_ZKT      (1 << 9)
+
+#define TARGET_ZBKB   ((riscv_zk_subext & MASK_ZBKB) != 0)
+#define TARGET_ZBKC   ((riscv_zk_subext & MASK_ZBKC) != 0)
+#define TARGET_ZBKX   ((riscv_zk_subext & MASK_ZBKX) != 0)
+#define TARGET_ZKNE   ((riscv_zk_subext & MASK_ZKNE) != 0)
+#define TARGET_ZKND   ((riscv_zk_subext & MASK_ZKND) != 0)
+#define TARGET_ZKNH   ((riscv_zk_subext & MASK_ZKNH) != 0)
+#define TARGET_ZKR    ((riscv_zk_subext & MASK_ZKR) != 0)
+#define TARGET_ZKSED  ((riscv_zk_subext & MASK_ZKSED) != 0)
+#define TARGET_ZKSH   ((riscv_zk_subext & MASK_ZKSH) != 0)
+#define TARGET_ZKT    ((riscv_zk_subext & MASK_ZKT) != 0)
+
 #endif /* ! GCC_RISCV_OPTS_H */
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 15bf89e17c2..617000975bf 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -198,6 +198,9 @@ int riscv_zi_subext
 TargetVariable
 int riscv_zb_subext
 
+TargetVariable
+int riscv_zk_subext
+
 Enum
 Name(isa_spec_class) Type(enum riscv_isa_spec_class)
 Supported ISA specs (for use with the -misa-spec= option):
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] RISC-V: Add implied defines of Zk, Zkn and Zks
  2021-11-22  8:19 [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 siyu
  2021-11-22  8:19 ` [PATCH v2 1/2] RISC-V: Add option defines for Scalar Cryptography siyu
@ 2021-11-22  8:19 ` siyu
  2021-11-24  3:22 ` [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 Palmer Dabbelt
  2 siblings, 0 replies; 7+ messages in thread
From: siyu @ 2021-11-22  8:19 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, jimw, cmuellner, palmer, andrew, lazyparser, jiawei,
	ben.marshall, mjos, Richard.Newell, SiYu Wu

From: SiYu Wu <siyu@isrc.iscas.ac.cn>

gcc/ChangeLog:

2021-11-22  SiYu Wu  <siyu@isrc.iscas.ac.cn>

        * common/config/riscv/riscv-common.c (riscv_implied_info):
        Add K-ext related entry.
        (riscv_supported_std_ext): Add 'k'.
        * config/riscv/arch-canonicalize (CANONICAL_ORDER): Add 'k'.
        (IMPLIED_EXT): Add K-ext related entry.
---
 gcc/common/config/riscv/riscv-common.c | 16 +++++++++++++++-
 gcc/config/riscv/arch-canonicalize     | 16 +++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c
index 14dc6057ecd..f352ff4ce7b 100644
--- a/gcc/common/config/riscv/riscv-common.c
+++ b/gcc/common/config/riscv/riscv-common.c
@@ -50,6 +50,20 @@ static const riscv_implied_info_t riscv_implied_info[] =
   {"d", "f"},
   {"f", "zicsr"},
   {"d", "zicsr"},
+  {"zk", "zkn"},
+  {"zk", "zkr"},
+  {"zk", "zkt"},
+  {"zkn", "zbkb"},
+  {"zkn", "zbkc"},
+  {"zkn", "zbkx"},
+  {"zkn", "zkne"},
+  {"zkn", "zknd"},
+  {"zkn", "zknh"},
+  {"zks", "zbkb"},
+  {"zks", "zbkc"},
+  {"zks", "zbkx"},
+  {"zks", "zksed"},
+  {"zks", "zksh"},
   {NULL, NULL}
 };
 
@@ -502,7 +516,7 @@ riscv_subset_list::lookup (const char *subset, int major_version,
 static const char *
 riscv_supported_std_ext (void)
 {
-  return "mafdqlcbjtpvn";
+  return "mafdqlcbjktpvn";
 }
 
 /* Parsing subset version.
diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize
index c7df3c8a313..90dbd194801 100755
--- a/gcc/config/riscv/arch-canonicalize
+++ b/gcc/config/riscv/arch-canonicalize
@@ -28,7 +28,7 @@ import itertools
 from functools import reduce
 
 
-CANONICAL_ORDER = "imafdgqlcbjtpvn"
+CANONICAL_ORDER = "imafdgqlcbjktpvn"
 LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
 
 #
@@ -36,6 +36,20 @@ LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
 #
 IMPLIED_EXT = {
   "d" : ["f"],
+  "zk" : ["zkn"],
+  "zk" : ["zkr"],
+  "zk" : ["zkt"],
+  "zkn" : ["zbkb"],
+  "zkn" : ["zbkc"],
+  "zkn" : ["zbkx"],
+  "zkn" : ["zkne"],
+  "zkn" : ["zknd"],
+  "zkn" : ["zknh"],
+  "zks" : ["zbkb"],
+  "zks" : ["zbkc"],
+  "zks" : ["zbkx"],
+  "zks" : ["zksed"],
+  "zks" : ["zksh"],
 }
 
 def arch_canonicalize(arch):
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6
  2021-11-22  8:19 [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 siyu
  2021-11-22  8:19 ` [PATCH v2 1/2] RISC-V: Add option defines for Scalar Cryptography siyu
  2021-11-22  8:19 ` [PATCH v2 2/2] RISC-V: Add implied defines of Zk, Zkn and Zks siyu
@ 2021-11-24  3:22 ` Palmer Dabbelt
  2021-11-24 10:00   ` Kito Cheng
  2 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2021-11-24  3:22 UTC (permalink / raw)
  To: siyu
  Cc: gcc-patches, ben.marshall, cmuellner, Andrew Waterman,
	Richard.Newell, jiawei, mjos, kito.cheng, Jim Wilson

[Changing to Jim's new address]

On Mon, 22 Nov 2021 00:19:08 PST (-0800), 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.
>
> Version logs:
>
> v2: As Kito mentions, now this patch only includes the arch string related
> stuff, the builtins and md changes is not included, waiting for the builtin
> and intrinsic added to the spec. Also removed the unnecessary patches and add
> Changelogs.

I don't think there's anything wrong with what's here, but IMO we should 
hold off on merging until GCC does something with these extensions.  

IIUC all this enables is passing "-march=*Zk*" instead of 
"-Wa,-march=*Zk*", and while that is useful I'm worried it'll just make 
more of a headache for users who lose a simple way to detect the 
intrinsics.  IMO forcing users to pass -Wa properly encodes the "GCC 
doesn't support these, but binutils does" scenario pretty sanely, and 
users doing things at this level of complexity should be used to that 
already because it happens somewhat frequently.

I'm not sure if I'm missing some use case this for this, though.

> SiYu Wu (2):
>   RISC-V: Add option defines for Scalar Cryptography
>   RISC-V: Add implied defines of Zk, Zkn and Zks
>
>  gcc/common/config/riscv/riscv-common.c | 38 +++++++++++++++++++++++++-
>  gcc/config/riscv/arch-canonicalize     | 16 ++++++++++-
>  gcc/config/riscv/riscv-opts.h          | 22 +++++++++++++++
>  gcc/config/riscv/riscv.opt             |  3 ++
>  4 files changed, 77 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6
  2021-11-24  3:22 ` [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 Palmer Dabbelt
@ 2021-11-24 10:00   ` Kito Cheng
  2021-11-24 16:41     ` Palmer Dabbelt
  0 siblings, 1 reply; 7+ messages in thread
From: Kito Cheng @ 2021-11-24 10:00 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: siyu, ben.marshall, Christoph Muellner, Andrew Waterman,
	Richard.Newell, jiawei, mjos, GCC Patches, Kito Cheng

I would prefer to accept those patchset even with no builtin function
or intrinsic function yet,
this not only add the support of -march option, but also introduce the
predefined macros like __riscv_zk*,
which could be used in *.S file to check if those instructions are
available or not.


On Wed, Nov 24, 2021 at 11:23 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> [Changing to Jim's new address]
>
> On Mon, 22 Nov 2021 00:19:08 PST (-0800), 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.
> >
> > Version logs:
> >
> > v2: As Kito mentions, now this patch only includes the arch string related
> > stuff, the builtins and md changes is not included, waiting for the builtin
> > and intrinsic added to the spec. Also removed the unnecessary patches and add
> > Changelogs.
>
> I don't think there's anything wrong with what's here, but IMO we should
> hold off on merging until GCC does something with these extensions.
>
> IIUC all this enables is passing "-march=*Zk*" instead of
> "-Wa,-march=*Zk*", and while that is useful I'm worried it'll just make
> more of a headache for users who lose a simple way to detect the
> intrinsics.  IMO forcing users to pass -Wa properly encodes the "GCC
> doesn't support these, but binutils does" scenario pretty sanely, and
> users doing things at this level of complexity should be used to that
> already because it happens somewhat frequently.
>
> I'm not sure if I'm missing some use case this for this, though.
>
> > SiYu Wu (2):
> >   RISC-V: Add option defines for Scalar Cryptography
> >   RISC-V: Add implied defines of Zk, Zkn and Zks
> >
> >  gcc/common/config/riscv/riscv-common.c | 38 +++++++++++++++++++++++++-
> >  gcc/config/riscv/arch-canonicalize     | 16 ++++++++++-
> >  gcc/config/riscv/riscv-opts.h          | 22 +++++++++++++++
> >  gcc/config/riscv/riscv.opt             |  3 ++
> >  4 files changed, 77 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6
  2021-11-24 10:00   ` Kito Cheng
@ 2021-11-24 16:41     ` Palmer Dabbelt
  2021-12-03 16:11       ` Kito Cheng
  0 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2021-11-24 16:41 UTC (permalink / raw)
  To: Kito Cheng
  Cc: siyu, ben.marshall, cmuellner, Andrew Waterman, Richard.Newell,
	jiawei, mjos, gcc-patches, kito.cheng

On Wed, 24 Nov 2021 02:00:33 PST (-0800), Kito Cheng wrote:
> I would prefer to accept those patchset even with no builtin function
> or intrinsic function yet,
> this not only add the support of -march option, but also introduce the
> predefined macros like __riscv_zk*,
> which could be used in *.S file to check if those instructions are
> available or not.

That makes sense, I guess I hadn't thought of that use case.

> On Wed, Nov 24, 2021 at 11:23 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>>
>> [Changing to Jim's new address]
>>
>> On Mon, 22 Nov 2021 00:19:08 PST (-0800), 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.
>> >
>> > Version logs:
>> >
>> > v2: As Kito mentions, now this patch only includes the arch string related
>> > stuff, the builtins and md changes is not included, waiting for the builtin
>> > and intrinsic added to the spec. Also removed the unnecessary patches and add
>> > Changelogs.
>>
>> I don't think there's anything wrong with what's here, but IMO we should
>> hold off on merging until GCC does something with these extensions.
>>
>> IIUC all this enables is passing "-march=*Zk*" instead of
>> "-Wa,-march=*Zk*", and while that is useful I'm worried it'll just make
>> more of a headache for users who lose a simple way to detect the
>> intrinsics.  IMO forcing users to pass -Wa properly encodes the "GCC
>> doesn't support these, but binutils does" scenario pretty sanely, and
>> users doing things at this level of complexity should be used to that
>> already because it happens somewhat frequently.
>>
>> I'm not sure if I'm missing some use case this for this, though.
>>
>> > SiYu Wu (2):
>> >   RISC-V: Add option defines for Scalar Cryptography
>> >   RISC-V: Add implied defines of Zk, Zkn and Zks
>> >
>> >  gcc/common/config/riscv/riscv-common.c | 38 +++++++++++++++++++++++++-
>> >  gcc/config/riscv/arch-canonicalize     | 16 ++++++++++-
>> >  gcc/config/riscv/riscv-opts.h          | 22 +++++++++++++++
>> >  gcc/config/riscv/riscv.opt             |  3 ++
>> >  4 files changed, 77 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6
  2021-11-24 16:41     ` Palmer Dabbelt
@ 2021-12-03 16:11       ` Kito Cheng
  0 siblings, 0 replies; 7+ messages in thread
From: Kito Cheng @ 2021-12-03 16:11 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: ben.marshall, Christoph Muellner, Andrew Waterman,
	Richard.Newell, jiawei, mjos, GCC Patches, Kito Cheng

Hi SiYu:

Committed, thanks!

On Thu, Nov 25, 2021 at 12:42 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> On Wed, 24 Nov 2021 02:00:33 PST (-0800), Kito Cheng wrote:
> > I would prefer to accept those patchset even with no builtin function
> > or intrinsic function yet,
> > this not only add the support of -march option, but also introduce the
> > predefined macros like __riscv_zk*,
> > which could be used in *.S file to check if those instructions are
> > available or not.
>
> That makes sense, I guess I hadn't thought of that use case.
>
> > On Wed, Nov 24, 2021 at 11:23 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
> >>
> >> [Changing to Jim's new address]
> >>
> >> On Mon, 22 Nov 2021 00:19:08 PST (-0800), 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.
> >> >
> >> > Version logs:
> >> >
> >> > v2: As Kito mentions, now this patch only includes the arch string related
> >> > stuff, the builtins and md changes is not included, waiting for the builtin
> >> > and intrinsic added to the spec. Also removed the unnecessary patches and add
> >> > Changelogs.
> >>
> >> I don't think there's anything wrong with what's here, but IMO we should
> >> hold off on merging until GCC does something with these extensions.
> >>
> >> IIUC all this enables is passing "-march=*Zk*" instead of
> >> "-Wa,-march=*Zk*", and while that is useful I'm worried it'll just make
> >> more of a headache for users who lose a simple way to detect the
> >> intrinsics.  IMO forcing users to pass -Wa properly encodes the "GCC
> >> doesn't support these, but binutils does" scenario pretty sanely, and
> >> users doing things at this level of complexity should be used to that
> >> already because it happens somewhat frequently.
> >>
> >> I'm not sure if I'm missing some use case this for this, though.
> >>
> >> > SiYu Wu (2):
> >> >   RISC-V: Add option defines for Scalar Cryptography
> >> >   RISC-V: Add implied defines of Zk, Zkn and Zks
> >> >
> >> >  gcc/common/config/riscv/riscv-common.c | 38 +++++++++++++++++++++++++-
> >> >  gcc/config/riscv/arch-canonicalize     | 16 ++++++++++-
> >> >  gcc/config/riscv/riscv-opts.h          | 22 +++++++++++++++
> >> >  gcc/config/riscv/riscv.opt             |  3 ++
> >> >  4 files changed, 77 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-03 16:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22  8:19 [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 siyu
2021-11-22  8:19 ` [PATCH v2 1/2] RISC-V: Add option defines for Scalar Cryptography siyu
2021-11-22  8:19 ` [PATCH v2 2/2] RISC-V: Add implied defines of Zk, Zkn and Zks siyu
2021-11-24  3:22 ` [PATCH v2 0/2] RISC-V: add gcc support for Scalar Cryptography v1.0.0-rc6 Palmer Dabbelt
2021-11-24 10:00   ` Kito Cheng
2021-11-24 16:41     ` Palmer Dabbelt
2021-12-03 16:11       ` Kito Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).