]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Reject 'd' extension with ILP32E ABI
authorPatrick O'Neill <patrick@rivosinc.com>
Tue, 30 Jul 2024 21:28:23 +0000 (14:28 -0700)
committerPatrick O'Neill <patrick@rivosinc.com>
Thu, 1 Aug 2024 18:25:47 +0000 (11:25 -0700)
Also add a testcase for -mabi=lp64d where 'd' is required.

gcc/ChangeLog:

PR target/116111
* config/riscv/riscv.cc (riscv_option_override): Add error.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/arch-41.c: New test.
* gcc.target/riscv/pr116111.c: New test.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/arch-41.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/pr116111.c [new file with mode: 0644]

index 8ece7859945ceb5597a8abef7bd28dd7a596c59e..b19d56149e7539dd1efe7669ca048ffddb99a4ec 100644 (file)
@@ -9818,6 +9818,11 @@ riscv_option_override (void)
        error ("rv64e requires lp64e ABI");
     }
 
+  /* ILP32E does not support the 'd' extension.  */
+  if (riscv_abi == ABI_ILP32E && UNITS_PER_FP_REG > 4)
+    error ("ILP32E ABI does not support the %qc extension",
+          UNITS_PER_FP_REG > 8 ? 'Q' : 'D');
+
   /* Zfinx require abi ilp32, ilp32e, lp64 or lp64e.  */
   if (TARGET_ZFINX
       && riscv_abi != ABI_ILP32 && riscv_abi != ABI_LP64
diff --git a/gcc/testsuite/gcc.target/riscv/arch-41.c b/gcc/testsuite/gcc.target/riscv/arch-41.c
new file mode 100644 (file)
index 0000000..699eeb2
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i -mabi=lp64d" } */
+int
+foo ()
+{}
+
+/* { dg-error "requested ABI requires '-march' to subsume the 'D' extension" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/riscv/pr116111.c b/gcc/testsuite/gcc.target/riscv/pr116111.c
new file mode 100644 (file)
index 0000000..5c824be
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32ed -mabi=ilp32e" } */
+int
+foo ()
+{}
+
+/* { dg-error "ILP32E ABI does not support the 'D' extension" "" { target *-*-* } 0 } */