From: Sebastian Huber Date: Thu, 14 Jan 2021 18:09:36 +0000 (+0100) Subject: nios2: Add -mcustom-fpu-cfg=fph2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42f4e23992487ecacba70575bf88af11288f557f;p=gcc.git nios2: Add -mcustom-fpu-cfg=fph2 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. 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. --- diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index e4349e766ae..3ff4ff1bfd2 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -1208,7 +1208,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 @@ -1252,6 +1252,27 @@ 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_fmaxs] = 232; + cfg->code[n2fpu_fmins] = 233; + cfg->code[n2fpu_round] = 248; + 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 8f100911048..3f30230b0c2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -26121,6 +26121,26 @@ 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-fmaxs=232 @gol +-mcustom-fmins=233 @gol +-mcustom-round=248 @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 +26151,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}. Please note that the custom instructions enabled by +@option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated +if @option{-ffinite-math-only} is specified. The custom instruction enabled by +@option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is +specified. 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