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: [PING] Fold (l)floor (fabs (x))


On Mon, 23 Oct 2006, Richard Guenther wrote:
> http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00529.html
> > 2006-08-16  Richard Guenther  <rguenther@suse.de>
> >
> >	* builtins.c (fold_builtin_floor): Fold floor (x) where
> >	x is nonnegative to trunc (x).
> >	(fold_builtin_int_roundingfn): Fold lfloor (x) where x is
> >	nonnegative to FIX_TRUNC_EXPR.
> >
> >	* gcc.dg/builtins-56.c: New testcase.

This is OK for mainline with one very minor style fix...

+ return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg),
+ 						    BUILT_IN_TRUNC), arglist);

I believe that the GCC style guidelines specify this should be indented as:

+ return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg),
+ 						    BUILT_IN_TRUNC),
+                                  arglist);


Thanks for fixing this, it's a clever optimization.  I can't think of
a platform where trunc is slower than floor, but if one exists, I'm
sure somebody will let us know.

Roger
--


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