RISC-V: Fix compilation failed for frflags builtin in C++ mode
- g++ will complain too few arguments for frflags builtin like bellow message: error: too few arguments to function 'unsigned int __builtin_riscv_frflags(void)' - However it's no arguments needed, it because we declare the function type with VOID arguments, that seems like require a VOID argument in the c++ front-end when GCC tried to resolve the function. gcc/ChangeLog * config/riscv/riscv-builtins.c (RISCV_FTYPE_NAME0): New. (RISCV_FTYPE_ATYPES0): New. (riscv_builtins): Using RISCV_USI_FTYPE for frflags. * config/riscv/riscv-ftypes.def: Remove VOID argument. gcc/testsuite/ChangeLog * g++.target/riscv/frflags.C: New.
This commit is contained in:
parent
f86e11a267
commit
33d9794b72
@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#include "langhooks.h"
|
||||
|
||||
/* Macros to create an enumeration identifier for a function prototype. */
|
||||
#define RISCV_FTYPE_NAME0(A) RISCV_##A##_FTYPE
|
||||
#define RISCV_FTYPE_NAME1(A, B) RISCV_##A##_FTYPE_##B
|
||||
|
||||
/* Classifies the prototype of a built-in function. */
|
||||
@ -121,11 +122,13 @@ AVAIL (hard_float, TARGET_HARD_FLOAT)
|
||||
|
||||
/* RISCV_FTYPE_ATYPESN takes N RISCV_FTYPES-like type codes and lists
|
||||
their associated RISCV_ATYPEs. */
|
||||
#define RISCV_FTYPE_ATYPES0(A) \
|
||||
RISCV_ATYPE_##A
|
||||
#define RISCV_FTYPE_ATYPES1(A, B) \
|
||||
RISCV_ATYPE_##A, RISCV_ATYPE_##B
|
||||
|
||||
static const struct riscv_builtin_description riscv_builtins[] = {
|
||||
DIRECT_BUILTIN (frflags, RISCV_USI_FTYPE_VOID, hard_float),
|
||||
DIRECT_BUILTIN (frflags, RISCV_USI_FTYPE, hard_float),
|
||||
DIRECT_NO_TARGET_BUILTIN (fsflags, RISCV_VOID_FTYPE_USI, hard_float)
|
||||
};
|
||||
|
||||
|
@ -26,5 +26,5 @@ along with GCC; see the file COPYING3. If not see
|
||||
LIST contains the return-type code followed by the codes for each
|
||||
argument type. */
|
||||
|
||||
DEF_RISCV_FTYPE (1, (USI, VOID))
|
||||
DEF_RISCV_FTYPE (0, (USI))
|
||||
DEF_RISCV_FTYPE (1, (VOID, USI))
|
||||
|
7
gcc/testsuite/g++.target/riscv/frflags.C
Normal file
7
gcc/testsuite/g++.target/riscv/frflags.C
Normal file
@ -0,0 +1,7 @@
|
||||
/* { dg-options "-O2 -march=rv32if -mabi=ilp32f" } */
|
||||
/* { dg-do compile } */
|
||||
|
||||
int f()
|
||||
{
|
||||
return __builtin_riscv_frflags();
|
||||
}
|
Loading…
Reference in New Issue
Block a user