The recent improvements to complex divide added this nugget to
c-cppbuiltins:
#ifdef HAVE_adddf3
builtin_define_with_int_value ("__LIBGCC_HAVE_HWDBL__",
HAVE_adddf3);
#endif
This is breaking the nios2 port:
In file included from ./tm.h:33,
from ../../../../../gcc/gcc/target.h:52,
from ../../../../../gcc/gcc/c-family/c-cppbuiltin.c:23:
../../../../../gcc/gcc/c-family/c-cppbuiltin.c: In function ‘void
c_cpp_builtins(cpp_reader*)’:
./insn-flags.h:50:22: error: ‘nios2_fpu_insn_enabled’ was not declared
in this scope
50 | #define HAVE_adddf3 (nios2_fpu_insn_enabled (n2fpu_faddd))
| ^~~~~~~~~~~~~~~~~~~~~~
../../../../../gcc/gcc/c-family/c-cppbuiltin.c:1387:7: note: in
expansion of macro ‘HAVE_adddf3’
1387 | HAVE_adddf3);
| ^~~~~~~~~~~
This comes from this in nios2.md:
(define_insn "<fop3><mode>3"
[(set (match_operand:F 0 "register_operand" "=r")
(FOP3:F (match_operand:F 1 "register_operand" "r")
(match_operand:F 2 "register_operand" "r")))]
"nios2_fpu_insn_enabled (n2fpu_f<fop3><f>)"
{ return nios2_fpu_insn_asm (n2fpu_f<fop3><f>); }
[(set_attr "type" "custom")])
Note the function call in the insn's condition.
While there are restrictions for conditions in named patterns, a
function call that just looks at what insns are enabled for the current
target would be considered OK.
The fix here is pretty simple. We just need to move the prototype in
nios2-protos.h into a different part of that file that isn't guarded on
RTX_CODE. That's enough to get the compiler building again. I'll
respin the Jenkins job to validate things further.
I wouldn't be terribly surprised to see other problems of this nature.
Jeff
commit 449d7b40f6f6be8d7f9aa7232c73b0371f0963bf
Author: Jeff Law <j...@tachyum.com>
Date: Thu Apr 29 09:08:56 2021 -0600
Fix nios2 build failure
gcc
* config/nios2/nios2-protos.h (nios2_fpu_insn_enabled): Move outside
of RTX_CODE guard.
diff --git a/gcc/config/nios2/nios2-protos.h b/gcc/config/nios2/nios2-protos.h
index df5d0c97316..b831b0fdcc2 100644
--- a/gcc/config/nios2/nios2-protos.h
+++ b/gcc/config/nios2/nios2-protos.h
@@ -28,6 +28,7 @@ extern void nios2_expand_prologue (void);
extern void nios2_expand_epilogue (bool);
extern bool nios2_expand_return (void);
extern void nios2_function_profiler (FILE *, int);
+extern bool nios2_fpu_insn_enabled (enum n2fpu_code);
#ifdef RTX_CODE
extern bool nios2_large_constant_p (rtx);
@@ -46,7 +47,6 @@ extern bool nios2_validate_compare (machine_mode, rtx *, rtx
*, rtx *);
extern bool nios2_validate_fpu_compare (machine_mode, rtx *, rtx *, rtx *,
bool);
-extern bool nios2_fpu_insn_enabled (enum n2fpu_code);
extern const char * nios2_fpu_insn_asm (enum n2fpu_code);
extern const char * nios2_add_insn_asm (rtx_insn *, rtx *);