On Wed, Jun 28, 2017 at 9:37 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Tue, Jun 27, 2017 at 10:52:47AM -0700, Andrew Pinski wrote: >> On Tue, Jun 27, 2017 at 7:56 AM, Richard Biener >> <richard.guent...@gmail.com> wrote: >> > On June 27, 2017 4:52:28 PM GMT+02:00, Tamar Christina >> > <tamar.christ...@arm.com> wrote: >> >>> >> +(for cmp (gt ge lt le) >> >>> >> + outp (convert convert negate negate) >> >>> >> + outn (negate negate convert convert) >> >>> >> + /* Transform (X > 0.0 ? 1.0 : -1.0) into copysign(1, X). */ >> >>> >> + /* Transform (X >= 0.0 ? 1.0 : -1.0) into copysign(1, X). */ >> >>> >> + /* Transform (X < 0.0 ? 1.0 : -1.0) into copysign(1,-X). */ >> >>> >> + /* Transform (X <= 0.0 ? 1.0 : -1.0) into copysign(1,-X). */ >> >>> >> +(simplify >> >>> >> + (cond (cmp @0 real_zerop) real_onep real_minus_onep) >> >>> >> + (if (!HONOR_NANS (type) && !HONOR_SIGNED_ZEROS (type) >> >>> >> + && types_match (type, TREE_TYPE (@0))) >> >>> >> + (switch >> >>> >> + (if (types_match (type, float_type_node)) >> >>> >> + (BUILT_IN_COPYSIGNF { build_one_cst (type); } (outp @0))) >> >>> >> + (if (types_match (type, double_type_node)) >> >>> >> + (BUILT_IN_COPYSIGN { build_one_cst (type); } (outp @0))) >> >>> >> + (if (types_match (type, long_double_type_node)) >> >>> >> + (BUILT_IN_COPYSIGNL { build_one_cst (type); } (outp @0)))))) > > The patch regressed the gcc.target/i386/cmov7.c testcase. > From the description in the testcase it was testing the combiner, so I've > transformed it into something that also tests the combiner the same way, > ok for trunk? That said, for copysign if we match it we don't emit a fcmov > while it might be a good idea. > > 2017-06-28 Jakub Jelinek <ja...@redhat.com> > > * gcc.target/i386/cmov7.c (sgn): Renamed to ... > (foo): ... this. Change constants such that it isn't matched > as __builtin_copysign, yet tests the combiner the same.
OK. Thanks, Uros. > --- gcc/testsuite/gcc.target/i386/cmov7.c.jj 2016-05-22 12:20:23.000000000 > +0200 > +++ gcc/testsuite/gcc.target/i386/cmov7.c 2017-06-28 09:20:24.000000000 > +0200 > @@ -10,7 +10,7 @@ > (set (reg:DF) (float_extend:DF (mem:SF (symbol_ref...)))). */ > > double > -sgn (double __x) > +foo (double __x) > { > - return __x >= 0.0 ? 1.0 : -1.0; > + return __x >= 1.0 ? 0.0 : -1.0; > } > > > Jakub