This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [GCC][PATCH][mid-end] Optimize x * copysign (1.0, y) [Patch (1/2)]


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]