Hi!

On Thu, Apr 23, 2020 at 02:34:03PM +0000, Zhanghaijian (A) wrote:
> Thanks for your suggestions. I have modified accordingly.
> Attached please find the adapted patch. Bootstrap and tested on aarch64 Linux 
> platform.
> Does the v2 patch look batter?
> 
> diff --git a/gcc/combine.c b/gcc/combine.c
> index cff76cd3303..ad8a385fc48 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -6643,7 +6643,8 @@ simplify_if_then_else (rtx x)
>  
>    /* Look for MIN or MAX.  */
>  
> -  if ((! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations)
> +  if ((! FLOAT_MODE_P (mode)
> +       || (!HONOR_NANS (mode) && !HONOR_SIGNED_ZEROS (mode)))
>        && comparison_p
>        && rtx_equal_p (XEXP (cond, 0), true_rtx)
>        && rtx_equal_p (XEXP (cond, 1), false_rtx)

> > The GENERIC folding routine producing
> > min/max is avoiding it when those are honored (and it doesn't check 
> > flag_unsafe_math_optmizations at all).
> > 
> > Certainly the patch is an incremental correct fix, with the flag 
> > testing replaced by the mode feature testing.
> 
> Yeah, and the SMAX etc. definition is so weak that it isn't obvious that this 
> combine transform is valid without this flag.  We can or should fix that, of 
> course :-)

Please put flag_unsafe_math_optimizations back?  It isn't clear at all
that we do not need it.

Also, do you have a changelog entry?


Segher

Reply via email to