https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94665
--- Comment #16 from z.zhanghaijian at huawei dot com <z.zhanghaijian at huawei dot com> --- (In reply to Segher Boessenkool from comment #15) > replacing flag_unsafe_math_operations by flag_finite_math_only isn't correct, > but you can add it instead, i.e. > > - if ((! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations) > + if (!FLOAT_MODE_P (mode) > + || (flag_unsafe_math_optimizations && flag_finite_math_only)) > > or such? > > Thanks for working on a patch! Ok, I will create a new PR to track this bug, and I will submit a bugfix patch whit that PR. In addition, I tracked the process of generating fmaxnm/fminnm and found that it was generated in phiopt (minmax_replacement) and if-conversion (noce_try_minmax). In the rtl combine, only fminnm can be generated. Is it necessary for us to improve this optimization in the rtl combine using the above patch in stage1?