This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [GCC][PATCH][mid-end] Optimize x * copysign (1.0, y) [Patch (1/2)]
- From: Tamar Christina <Tamar dot Christina at arm dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, "law at redhat dot com" <law at redhat dot com>, "ian at airs dot com" <ian at airs dot com>, "rdsandiford at googlemail dot com" <rdsandiford at googlemail dot com>
- Date: Tue, 13 Jun 2017 10:17:02 +0000
- Subject: RE: [GCC][PATCH][mid-end] Optimize x * copysign (1.0, y) [Patch (1/2)]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tamar dot Christina at arm dot com;
- Nodisclaimer: True
- References: <VI1PR0801MB20316B7A94D73C180C266C15FFCD0@VI1PR0801MB2031.eurprd08.prod.outlook.com> <alpine.LSU.2.20.1706121053440.7349@zhemvz.fhfr.qr>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi Richard,
Thanks for the feedback, I'll update the patch accordingly.
> What does
>
> > (copysigns @0 (negate @1)): Likewise.
>
> do?
>
Sorry this slipped through my clean-up. The patch doesn't actually contain this definition anymore.
> Third, new IL that is present throughout the compilation always poses the
> risk that while passes may be able to handle copysign they do not handle
> xorsign (vectorization?). In this case it looks like the matching is simply to
> enhance RTL expansion which means it should ideally be done close to RTL
> expansion only. If you write
>
> (match (xorsign_p @0 @1)
> (mult:c (copysign real_onep @0) @1))
>
> you can call gimple_xorsign_p (you need to declare it, see the generated
> gimple-match.c file for the definition) from, say,
> pass_optimize_widening_mul, which despite its name is used as a kitchen-
> sink for late GIMPLE pattern-matching stuff to enhance RTL expansion /
> instruction selection.
>
> Thanks,
> Richard.
>
> >
> > gcc/
> > 2017-06-07 Tamar Christina <tamar.christina@arm.com>
> >
> > * builtins.def (BUILT_IN_XORSIGN, BUILT_IN_XORSIGNF): New.
> > (BUILT_IN_XORSIGNL, BUILT_IN_XORSIGN_FLOAT_NX): Likewise.
> > * match.pd (mult (COPYSIGN:s real_onep @0) @1): New simplifier.
> > (mult (COPYSIGN:s real_mus_onep @0) @1): Likewise.
> > (copysigns @0 (negate @1)): Likewise.
> > * builtins.c (expand_builtin_copysign): Promoted local to argument.
> > (expand_builtin): Added CASE_FLT_FN_FLOATN_NX
> (BUILT_IN_XORSIGN) and
> > CASE_FLT_FN (BUILT_IN_XORSIGN).
> > (BUILT_IN_COPYSIGN): Updated function call.
> > * optabs.h (expand_copysign): New bool.
> > (expand_xorsign): New.
> > * optabs.def (xorsign_optab): New.
> > * optabs.c (expand_copysign): New parameter.
> > * fortran/f95-lang.c (xorsignl, xorsign, xorsignf): New.
> > * fortran/mathbuiltins.def (XORSIGN): New.
> >
> > gcc/testsuite/
> > 2017-06-07 Tamar Christina <tamar.christina@arm.com>
> >
> > * gcc.dg/tree-ssa/xorsign.c: New.
> > * gcc.dg/xorsign_exec.c: New.
> > * gcc.dg/vec-xorsign_exec.c: New.
> > * gcc.dg/tree-ssa/reassoc-39.c (f2, f3): Updated constant to 2.
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton,
> HRB 21284 (AG Nuernberg)