public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nios2: Add -mcustom-fpu-cfg=fph2
@ 2021-01-14 19:16 Sebastian Huber
  2021-01-14 19:16 ` [PATCH 2/2] RTEMS: Add -mcustom-fpu-cfg=fph2 multilib Sebastian Huber
  2021-01-15 19:12 ` [PATCH 1/2] nios2: Add -mcustom-fpu-cfg=fph2 Sandra Loosemore
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Huber @ 2021-01-14 19:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Sandra Loosemore

The new -mcustom-fpu-cfg=fph2 option variant is useful to build a
multilib for the "Nios II Floating Point Hardware 2 Component":

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_nios2_custom_instruction.pdf

Directly using the corresponding -mcustom-insn=N options for this
floating-point unit leads to a combinatorial explosion in the potential
count of multilibs which may break the build.

The following instructions supported by this component are not enabled
by this option:

* -mcustom-fmins
* -mcustom-fmaxs
* -mcustom-round

The reason is that these instructions are only in effect in combination
with other options. If they are not set, then a build error occurs in
libatomic since -Werror is used for building this library:

cc1: error: switch '-mcustom-fmins' has no effect unless '-ffinite-math-only' is specified [-Werror]
cc1: error: switch '-mcustom-fmaxs' has no effect unless '-ffinite-math-only' is specified [-Werror]
cc1: error: switch '-mcustom-round' has no effect unless '-fno-math-errno' is specified [-Werror]

gcc/

	* config/nios2/nios2.c (NIOS2_FPU_CONFIG_NUM): Adjust value.
	(nios2_init_fpu_configs): Provide register values for new
	-mcustom-fpu-cfg=fph2 option variant.
	* doc/invoke.texi (-mcustom-fpu-cfg=fph2): Document new option
	variant.
---
 gcc/config/nios2/nios2.c | 20 +++++++++++++++++++-
 gcc/doc/invoke.texi      | 25 +++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index 3bffabe9856..fc9c8b70807 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -1236,7 +1236,7 @@ struct nios2_fpu_config
   int code[n2fpu_code_num];
 };
 
-#define NIOS2_FPU_CONFIG_NUM 3
+#define NIOS2_FPU_CONFIG_NUM 4
 static struct nios2_fpu_config custom_fpu_config[NIOS2_FPU_CONFIG_NUM];
 
 static void
@@ -1280,6 +1280,24 @@ nios2_init_fpu_configs (void)
   cfg->code[n2fpu_fsubs]   = 254;
   cfg->code[n2fpu_fdivs]   = 255;
 
+  NEXT_FPU_CONFIG;
+  cfg->name = "fph2";
+  cfg->code[n2fpu_fabss]   = 224;
+  cfg->code[n2fpu_fnegs]   = 225;
+  cfg->code[n2fpu_fcmpnes] = 226;
+  cfg->code[n2fpu_fcmpeqs] = 227;
+  cfg->code[n2fpu_fcmpges] = 228;
+  cfg->code[n2fpu_fcmpgts] = 229;
+  cfg->code[n2fpu_fcmples] = 230;
+  cfg->code[n2fpu_fcmplts] = 231;
+  cfg->code[n2fpu_fixsi]   = 249;
+  cfg->code[n2fpu_floatis] = 250;
+  cfg->code[n2fpu_fsqrts]  = 251;
+  cfg->code[n2fpu_fmuls]   = 252;
+  cfg->code[n2fpu_fadds]   = 253;
+  cfg->code[n2fpu_fsubs]   = 254;
+  cfg->code[n2fpu_fdivs]   = 255;
+
 #undef NEXT_FPU_CONFIG
   gcc_assert (i == NIOS2_FPU_CONFIG_NUM);
 }
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 298f1f873e3..91fd980550f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -26121,6 +26121,23 @@ Currently, the following sets are defined:
 -mcustom-fdivs=255 @gol
 -fsingle-precision-constant}
 
+@option{-mcustom-fpu-cfg=fph2} is equivalent to:
+@gccoptlist{-mcustom-fabss=224 @gol
+-mcustom-fnegs=225 @gol
+-mcustom-fcmpnes=226 @gol
+-mcustom-fcmpeqs=227 @gol
+-mcustom-fcmpges=228 @gol
+-mcustom-fcmpgts=229 @gol
+-mcustom-fcmples=230 @gol
+-mcustom-fcmplts=231 @gol
+-mcustom-fixsi=249 @gol
+-mcustom-floatis=250 @gol
+-mcustom-fsqrts=251 @gol
+-mcustom-fmuls=252 @gol
+-mcustom-fadds=253 @gol
+-mcustom-fsubs=254 @gol
+-mcustom-fdivs=255 @gol}
+
 Custom instruction assignments given by individual
 @option{-mcustom-@var{insn}=} options override those given by
 @option{-mcustom-fpu-cfg=}, regardless of the
@@ -26131,6 +26148,14 @@ configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
 function attribute (@pxref{Function Attributes})
 or pragma (@pxref{Function Specific Option Pragmas}).
 
+The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
+Hardware 2 Component}.  This component supports also the custom instructions
+@option{-mcustom-fmins=233}, @option{-mcustom-fmaxs=234}, and
+@option{-mcustom-round=248}.  These options are not enabled by
+@option{-mcustom-fpu-cfg=fph2} since they are only in effect if other options
+are enabled.  In contrast to the other configurations,
+@option{-fsingle-precision-constant} is not set.
+
 @end table
 
 These additional @samp{-m} options are available for the Altera Nios II
-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-15 22:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 19:16 [PATCH 1/2] nios2: Add -mcustom-fpu-cfg=fph2 Sebastian Huber
2021-01-14 19:16 ` [PATCH 2/2] RTEMS: Add -mcustom-fpu-cfg=fph2 multilib Sebastian Huber
2021-01-15 19:13   ` Sandra Loosemore
2021-01-15 19:12 ` [PATCH 1/2] nios2: Add -mcustom-fpu-cfg=fph2 Sandra Loosemore
2021-01-15 21:27   ` Sebastian Huber
2021-01-15 22:08     ` Sandra Loosemore

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).