Hi Richard,

>               switch (code)
>                 {
>                 case MULT_EXPR:
>                   if (!convert_mult_to_widen (stmt, &gsi)
>                       && !convert_expand_mult_copysign (stmt, &gsi)
>                       && convert_mult_to_fma (stmt,
>                                               gimple_assign_rhs1 (stmt),
>                                               gimple_assign_rhs2 (stmt)))
> 
> given you likely do not want x * copysign (1, y) + z to be transformed into
> FMA but still use xorsign?

Ah yes, that's correct, thanks!

> 
> I am also eventually missing a single-use check on the copysign result.  If 
> the
> result of copysign is used in multiple places do we want to keep the multiply
> or is the xorsign much cheaper?
> The only eventual disadvantage would be higher register pressure if y and
> copysing (1, y) were not live at the same time before.

No the transformation should be limited for single use, I've updated the patch 
accordingly.

Thanks,
Tamar

> 
> 
> > gcc/
> > 2017-08-03  Tamar Christina  <tamar.christ...@arm.com>
> >         Andrew Pinski <pins...@gmail.com>
> >
> >     PR middle-end/19706
> >     * internal-fn.def (XORSIGN): New.
> >     * optabs.def (xorsign_optab): New.
> >     * tree-ssa-math-opts.c (is_copysign_call_with_1): New.
> >     (convert_expand_mult_copysign): New.
> >     (pass_optimize_widening_mul::execute): Call
> convert_expand_mult_copysign.
> >
> >
> 
> --
> Richard Biener <rguent...@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton,
> HRB 21284 (AG Nuernberg)

Attachment: xorsign-math-sp2.patch
Description: xorsign-math-sp2.patch

Reply via email to