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, 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);


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).

Thanks.

Roger
--


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