[GCC][PATCH][mid-end][Version 3] Optimize x * copysign (1.0, y) [Patch (1/2)]
Tamar Christina
Tamar.Christina@arm.com
Mon Aug 7 09:34:00 GMT 2017
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.christina@arm.com>
> > Andrew Pinski <pinskia@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 <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton,
> HRB 21284 (AG Nuernberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xorsign-math-sp2.patch
Type: application/octet-stream
Size: 4083 bytes
Desc: xorsign-math-sp2.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170807/c180db88/attachment.obj>
More information about the Gcc-patches
mailing list