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: [PATCH] Provide basic folding for __builtin_powi


On Wed, 9 Feb 2005, Roger Sayle wrote:

>
> On Wed, 9 Feb 2005, Richard Guenther wrote:
> > 2005-02-09  Richard Guenther  <rguenth@gcc.gnu.org>
> >
> >	* builtins.c (fold_builtin_powi): New function.
> >	(fold_builtin_1): Call it.
> >
>
> The following bit...
>
> > +   if (TREE_CODE (arg1) == INTEGER_CST
> > +       && ! TREE_CONSTANT_OVERFLOW (arg1)
> > +       && (TREE_INT_CST_HIGH (arg1) == 0
> > + 	  || TREE_INT_CST_HIGH (arg1) == -1))
> > +     {
> > +       HOST_WIDE_INT c = TREE_INT_CST_LOW (arg1);
>
> is better written as
>
> 	if (host_integerp (arg1, 1))
> 	{
> 	  HOST_WIDE_INT c = TREE_INT_CST_LOW (arg1);

>From looking at host_integerp you probably mean

	if (host_integerp (arg1, 0))

?

>
>
> Ok for mainline with that change.  It looks like you've already
> got testsuite coverage for __builtin_powi with pr19402-*.c, but
> for extra credit feel free to another testcase or two (perhaps
> along the lines of builtins-8.c and/or builtins-14.c).

Ok, I'm re-checking with the changes.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/


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