public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Trivial fix to get nios2 building again
@ 2021-04-29 15:13 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2021-04-29 15:13 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2012 bytes --]

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


[-- Attachment #2: j.diff --]
[-- Type: text/plain, Size: 1147 bytes --]

commit 449d7b40f6f6be8d7f9aa7232c73b0371f0963bf
Author: Jeff Law <jlaw@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 *);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-29 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 15:13 [committed] Trivial fix to get nios2 building again Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).