On Tue, Nov 13, 2018 at 10:25 PM Giuliano Augusto Faulin Belinassi <giuliano.belina...@usp.br> wrote: > > Only do the optimization if flag_signed_zeros && > !flag_finite_math_only is set, as suggested in the previous iteration. > > Before, the patch did the optimization even when -fno-signed-zeros and > -ffinite-math-only was set. This could generate badly incorrect > results for targets that do not support infinite or signed zeros.
How's the result wrong if there are no signed zeros? Note that -ffast-math enables -fno-signed-zeros for example. So both of your check look backwards. Also the support for signed zeros and infs/nans should be guarded with !HONOR_SIGNED_ZEROS (type) && !HONOR_NANS (type) && !HONOR_INFINITIES (type) which then means there's no difference between -0. and 0. and there are no NaNs or Infs in the inputs and ouptut NaNs or Infs need not be produced. Richard. > I also updated the tests with the proper flags. > > gcc/ChangeLog > 2018-11-13 Giuliano Belinassi <giuliano.belina...@usp.br> > > * match.pd (sinh (atanh (x))): New simplification rules. > (cosh (atanh (x))): Likewise. > > gcc/testsuite/ChangeLog > 2018-11-13 Giuliano Belinassi <giuliano.belina...@usp.br> > > * gcc.dg/sinhatanh-1.c: New test. > * gcc.dg/sinhatanh-2.c: New test. > > There are no tests in trunk that seems to be breaking because of this patch.