diff mbox series

[RFC,v1,02/10] RISC-V: Recognize Zicond (conditional operations) extension

Message ID 20230210224150.2801962-3-philipp.tomsich@vrull.eu
State New
Headers show
Series [RFC,v1,01/10] docs: Document a canonical RTL for a conditional-zero insns | expand

Commit Message

Philipp Tomsich Feb. 10, 2023, 10:41 p.m. UTC
This adds the RISC-V Zicond extension to the option parsing.

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc: Recognize "zicond"
	as part of an architecture string.
	* config/riscv/riscv-opts.h (MASK_ZICOND): Define.
	(TARGET_ZICOND): Define.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
---

 gcc/common/config/riscv/riscv-common.cc | 3 +++
 gcc/config/riscv/riscv-opts.h           | 2 ++
 2 files changed, 5 insertions(+)

Comments

Jeff Law April 20, 2023, 5:44 p.m. UTC | #1
On 2/10/23 15:41, Philipp Tomsich wrote:
> This adds the RISC-V Zicond extension to the option parsing.
> 
> gcc/ChangeLog:
> 
> 	* common/config/riscv/riscv-common.cc: Recognize "zicond"
> 	as part of an architecture string.
> 	* config/riscv/riscv-opts.h (MASK_ZICOND): Define.
> 	(TARGET_ZICOND): Define.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 787674003cb..999e1926db1 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -163,6 +163,8 @@  static const struct riscv_ext_version riscv_ext_version_table[] =
   {"zifencei", ISA_SPEC_CLASS_20191213, 2, 0},
   {"zifencei", ISA_SPEC_CLASS_20190608, 2, 0},
 
+  {"zicond", ISA_SPEC_CLASS_NONE, 1, 0},
+
   {"zawrs", ISA_SPEC_CLASS_NONE, 1, 0},
 
   {"zba", ISA_SPEC_CLASS_NONE, 1, 0},
@@ -1181,6 +1183,7 @@  static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
 
   {"zicsr",    &gcc_options::x_riscv_zi_subext, MASK_ZICSR},
   {"zifencei", &gcc_options::x_riscv_zi_subext, MASK_ZIFENCEI},
+  {"zicond",   &gcc_options::x_riscv_zi_subext, MASK_ZICOND},
 
   {"zawrs", &gcc_options::x_riscv_za_subext, MASK_ZAWRS},
 
diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
index ff398c0a2ae..61d5212da20 100644
--- a/gcc/config/riscv/riscv-opts.h
+++ b/gcc/config/riscv/riscv-opts.h
@@ -69,9 +69,11 @@  enum stack_protector_guard {
 
 #define MASK_ZICSR    (1 << 0)
 #define MASK_ZIFENCEI (1 << 1)
+#define MASK_ZICOND   (1 << 2)
 
 #define TARGET_ZICSR    ((riscv_zi_subext & MASK_ZICSR) != 0)
 #define TARGET_ZIFENCEI ((riscv_zi_subext & MASK_ZIFENCEI) != 0)
+#define TARGET_ZICOND   ((riscv_zi_subext & MASK_ZICOND) != 0)
 
 #define MASK_ZAWRS   (1 << 0)
 #define TARGET_ZAWRS ((riscv_za_subext & MASK_ZAWRS) != 0)