On 1/14/21 12:16 PM, Sebastian Huber wrote:
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]


Seems like it would be better to have a separate switch to disable these warnings, or perhaps remove them entirely, as I'm sure there are other custom instructions that are not used unless -ffinite-math-only, -fno-math-errno, or -ffast-math are also specified (e.g., I see an issue in our internal tracker about fsqrts) and we don't consistently warn about those. So I think the warnings are of dubious value. Maybe the existing -Wdisabled-optimization flag could be used here to control the warnings we're already checking for?

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.

The rest of the patch looks fine to me.

-Sandra

Reply via email to