[RFC] gas: RISC-V: Add support for RV64E/lp64e
Palmer Dabbelt
palmer@rivosinc.com
Wed Jul 13 04:45:22 GMT 2022
The RV64E ISA was recently written down, add support for it and the
corresponding ABI.
---
This is all still in flight, but evidently RV64E exists. I haven't
tested this at all, but given that we don't even have the ABI docs lined
up yet it's likely a bit away from being mergable.
---
gas/config/tc-riscv.c | 8 ++++++--
gas/doc/c-riscv.texi | 2 +-
gas/testsuite/gas/riscv/mabi-attr-rv64e.s | 1 +
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l | 2 +-
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l | 2 +-
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l | 2 +-
gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.d | 3 +++
gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.l | 2 ++
8 files changed, 16 insertions(+), 6 deletions(-)
create mode 100644 gas/testsuite/gas/riscv/mabi-attr-rv64e.s
create mode 100644 gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.d
create mode 100644 gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.l
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index fb3fc649802..3d31f170e86 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -335,8 +335,10 @@ riscv_set_abi_by_arch (void)
else if (abi_xlen < xlen)
as_bad ("%d-bit ABI not yet supported on %d-bit ISA", abi_xlen, xlen);
- if (riscv_subset_supports (&riscv_rps_as, "e") && !rve_abi)
- as_bad ("only the ilp32e ABI is supported for e extension");
+ if (riscv_subset_supports (&riscv_rps_as, "e") && !rve_abi && xlen == 32)
+ as_bad ("only the ilp32e ABI is supported for the RV32E base ISA");
+ if (riscv_subset_supports (&riscv_rps_as, "e") && !rve_abi && xlen == 64)
+ as_bad ("only the lp64e ABI is supported for the RV64E base ISA");
if (float_abi == FLOAT_ABI_SINGLE
&& !riscv_subset_supports (&riscv_rps_as, "f"))
@@ -3398,6 +3400,8 @@ md_parse_option (int c, const char *arg)
riscv_set_abi (32, FLOAT_ABI_DOUBLE, false);
else if (strcmp (arg, "ilp32q") == 0)
riscv_set_abi (32, FLOAT_ABI_QUAD, false);
+ else if (strcmp (arg, "lp64e") == 0)
+ riscv_set_abi (64, FLOAT_ABI_SOFT, true);
else if (strcmp (arg, "lp64") == 0)
riscv_set_abi (64, FLOAT_ABI_SOFT, false);
else if (strcmp (arg, "lp64f") == 0)
diff --git a/gas/doc/c-riscv.texi b/gas/doc/c-riscv.texi
index 21d867e9cf0..18bf9d8ad2d 100644
--- a/gas/doc/c-riscv.texi
+++ b/gas/doc/c-riscv.texi
@@ -660,7 +660,7 @@ value if the tag number is even.
@table @r
@item Tag_RISCV_stack_align (4)
Tag_RISCV_strict_align records the N-byte stack alignment for this object. The
-default value is 16 for RV32I or RV64I, and 4 for RV32E.
+default value is 16 for RV32I or RV64I, 8 for RV64E, and 4 for RV32E.
The smallest value will be used if object files with different
Tag_RISCV_stack_align values are merged.
diff --git a/gas/testsuite/gas/riscv/mabi-attr-rv64e.s b/gas/testsuite/gas/riscv/mabi-attr-rv64e.s
new file mode 100644
index 00000000000..65320c8b5a4
--- /dev/null
+++ b/gas/testsuite/gas/riscv/mabi-attr-rv64e.s
@@ -0,0 +1 @@
+ .attribute arch,"rv64e"
diff --git a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l
index f7306cb24d2..3bd1c280816 100644
--- a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l
+++ b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l
@@ -1,4 +1,4 @@
.*Assembler messages:
.*Error: can't have 64-bit ABI on 32-bit ISA
-.*Error: only the ilp32e ABI is supported for e extension
+.*Error: only the ilp32e ABI is supported for the RV32E base ISA
.*Error: ilp32d/lp64d ABI can't be used when d extension isn't supported
diff --git a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l
index 706690ac9c6..1da2a3648a3 100644
--- a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l
+++ b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l
@@ -1,4 +1,4 @@
.*Assembler messages:
.*Error: can't have 64-bit ABI on 32-bit ISA
-.*Error: only the ilp32e ABI is supported for e extension
+.*Error: only the ilp32e ABI is supported for the RV32E base ISA
.*Error: ilp32f/lp64f ABI can't be used when f extension isn't supported
diff --git a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l
index ab64b1546f6..16b218013e4 100644
--- a/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l
+++ b/gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l
@@ -1,4 +1,4 @@
.*Assembler messages:
.*Error: can't have 64-bit ABI on 32-bit ISA
-.*Error: only the ilp32e ABI is supported for e extension
+.*Error: only the ilp32e ABI is supported for the RV32E base ISA
.*Error: ilp32q/lp64q ABI can't be used when q extension isn't supported
diff --git a/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.d b/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.d
new file mode 100644
index 00000000000..6c5e5274def
--- /dev/null
+++ b/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.d
@@ -0,0 +1,3 @@
+#as: -march-attr -mabi=lp64
+#source: mabi-attr-rv64e.s
+#error_output: mabi-fail-rv64e-lp64.l
diff --git a/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.l b/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.l
new file mode 100644
index 00000000000..44215406236
--- /dev/null
+++ b/gas/testsuite/gas/riscv/mabi-fail-rv64e-lp64.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*Error: only the lp64e ABI is supported for the RV64E base ISA
--
2.34.1
More information about the Binutils
mailing list