[RFC] RISC-V: Remove f{r,s}flags builtins

Message ID 20231129114905.3057404-1-christoph.muellner@vrull.eu
State Unresolved
Headers
Series [RFC] RISC-V: Remove f{r,s}flags builtins |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Christoph Müllner Nov. 29, 2023, 11:49 a.m. UTC
  From: Christoph Müllner <christoph.muellner@vrull.eu>

We have two builtins which are undocumented and have no known users.
Further, they don't exist in LLVM (so are no portable).
This means they are in an unclear state of being supported or not.
Let's remove them get them out of this undecided state.

A discussion about making these builtins available in all
compilers was held many years ago with the decision to
not document them in the RISC-V C API documentation:
  https://github.com/riscv-non-isa/riscv-c-api-doc/pull/3

This is an RFC patch as this breaks existing code that uses
these builtins, even if we don't know if such code exists.

An alternative to this patch would be to document them
in gcc/doc/extend.texi (like has been done with __builtin_riscv_pause)
and put them into a supported state.

This patch removes two tests for these builtins.
A test of this patch did not trigger any regressions in riscv.exp.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>

gcc/ChangeLog:

	* config/riscv/riscv-builtins.cc: Remove the builtins
	__builtin_riscv_frflags and __builtin_riscv_fsflags.

gcc/testsuite/ChangeLog:

	* g++.target/riscv/frflags.C: Removed.
	* gcc.target/riscv/fsflags.c: Removed.
---
 gcc/config/riscv/riscv-builtins.cc       |  2 --
 gcc/testsuite/g++.target/riscv/frflags.C |  7 -------
 gcc/testsuite/gcc.target/riscv/fsflags.c | 16 ----------------
 3 files changed, 25 deletions(-)
 delete mode 100644 gcc/testsuite/g++.target/riscv/frflags.C
 delete mode 100644 gcc/testsuite/gcc.target/riscv/fsflags.c
  

Patch

diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc
index fc3976f3ba1..1655492b246 100644
--- a/gcc/config/riscv/riscv-builtins.cc
+++ b/gcc/config/riscv/riscv-builtins.cc
@@ -188,8 +188,6 @@  static const struct riscv_builtin_description riscv_builtins[] = {
   #include "riscv-scalar-crypto.def"
   #include "corev.def"
 
-  DIRECT_BUILTIN (frflags, RISCV_USI_FTYPE, hard_float),
-  DIRECT_NO_TARGET_BUILTIN (fsflags, RISCV_VOID_FTYPE_USI, hard_float),
   RISCV_BUILTIN (pause, "pause", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE, hint_pause),
 };
 
diff --git a/gcc/testsuite/g++.target/riscv/frflags.C b/gcc/testsuite/g++.target/riscv/frflags.C
deleted file mode 100644
index 6353044dcf7..00000000000
--- a/gcc/testsuite/g++.target/riscv/frflags.C
+++ /dev/null
@@ -1,7 +0,0 @@ 
-/* { dg-options "-O2 -march=rv32if -mabi=ilp32f" } */
-/* { dg-do compile } */
-
-int f()
-{
-  return __builtin_riscv_frflags();
-}
diff --git a/gcc/testsuite/gcc.target/riscv/fsflags.c b/gcc/testsuite/gcc.target/riscv/fsflags.c
deleted file mode 100644
index 74a97b8a7c7..00000000000
--- a/gcc/testsuite/gcc.target/riscv/fsflags.c
+++ /dev/null
@@ -1,16 +0,0 @@ 
-/* Verify that fsflags is using the correct register or immediate.  */
-/* { dg-do compile } */
-/* { dg-require-effective-target hard_float } */
-/* { dg-options "-O" } */
-
-void foo1 (int a)
-{
-   __builtin_riscv_fsflags(a);
-}
-void foo2 ()
-{
-   __builtin_riscv_fsflags(4);
-}
-
-/* { dg-final { scan-assembler-times "fsflags\t" 1 } } */
-/* { dg-final { scan-assembler-times "fsflagsi\t" 1 } } */