On Sun, Nov 13, 2022 at 10:46:36PM +0100, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> This patch add basic support for the XTheadFmv and XTheadInt
> ISA extension. As both extensions only contain instruction,
> which are not supposed to be emitted by the compiler, the support
> only covers awareness of the extension name in the march string
> and the definition of a feature test macro.
>
I think the XTheadFmv can be emitted when the data is moved between
DImode and DFmode in rv32 target. The intructions are similar to the
move instructions of new standard extension "zfa".
Thanks,
Cooper
@@ -228,6 +228,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"xtheadcmo", ISA_SPEC_CLASS_NONE, 1, 0},
{"xtheadcondmov", ISA_SPEC_CLASS_NONE, 1, 0},
{"xtheadfmemidx", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"xtheadfmv", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"xtheadint", ISA_SPEC_CLASS_NONE, 1, 0},
{"xtheadmac", ISA_SPEC_CLASS_NONE, 1, 0},
{"xtheadmemidx", ISA_SPEC_CLASS_NONE, 1, 0},
{"xtheadsync", ISA_SPEC_CLASS_NONE, 1, 0},
@@ -1263,6 +1265,8 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
{"xtheadcmo", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADCMO},
{"xtheadcondmov", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADCONDMOV},
{"xtheadfmemidx", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADFMEMIDX},
+ {"xtheadfmv", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADFMV},
+ {"xtheadint", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADINT},
{"xtheadmac", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADMAC},
{"xtheadmemidx", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADMEMIDX},
{"xtheadsync", &gcc_options::x_riscv_xthead_subext, MASK_XTHEADSYNC},
@@ -201,11 +201,15 @@ enum stack_protector_guard {
#define TARGET_XTHEADCONDMOV ((riscv_xthead_subext & MASK_XTHEADCONDMOV) != 0)
#define MASK_XTHEADFMEMIDX (1 << 5)
#define TARGET_XTHEADFMEMIDX ((riscv_xthead_subext & MASK_XTHEADFMEMIDX) != 0)
-#define MASK_XTHEADMAC (1 << 6)
+#define MASK_XTHEADFMV (1 << 6)
+#define TARGET_XTHEADFMV ((riscv_xthead_subext & MASK_XTHEADFMV) != 0)
+#define MASK_XTHEADINT (1 << 7)
+#define TARGET_XTHEADINT ((riscv_xthead_subext & MASK_XTHEADINT) != 0)
+#define MASK_XTHEADMAC (1 << 8)
#define TARGET_XTHEADMAC ((riscv_xthead_subext & MASK_XTHEADMAC) != 0)
-#define MASK_XTHEADMEMIDX (1 << 7)
+#define MASK_XTHEADMEMIDX (1 << 9)
#define TARGET_XTHEADMEMIDX ((riscv_xthead_subext & MASK_XTHEADMEMIDX) != 0)
-#define MASK_XTHEADSYNC (1 << 8)
+#define MASK_XTHEADSYNC (1 << 10)
#define TARGET_XTHEADSYNC ((riscv_xthead_subext & MASK_XTHEADSYNC) != 0)
#endif /* ! GCC_RISCV_OPTS_H */
new file mode 100644
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_xtheadfmv" { target { rv32 } } } */
+/* { dg-options "-march=rv64gc_xtheadfmv" { target { rv64 } } } */
+
+#ifndef __riscv_xtheadfmv
+#error Feature macro not defined
+#endif
+
+int
+foo (int a)
+{
+ return a;
+}
+
new file mode 100644
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_xtheadint" { target { rv32 } } } */
+/* { dg-options "-march=rv64gc_xtheadint" { target { rv64 } } } */
+
+#ifndef __riscv_xtheadint
+#error Feature macro not defined
+#endif
+
+int
+foo (int a)
+{
+ return a;
+}
+