Patchwork PR57073 - Optimize __builtin_powif (-1.0, k) to k & 1 ? -1.0 : 1.0

login
register
mail settings
Submitter Tobias Burnus
Date May 31, 2013, 8:57 a.m.
Message ID <51A86605.2030106@net-b.de>
Download mbox | patch
Permalink /patch/247868/
State New
Headers show

Comments

Tobias Burnus - May 31, 2013, 8:57 a.m.
Richard Biener wrote:
> Why sink the !host_integerp check?  Please keep it where it is now.
> Then
>
> +                 if (real_minus_onep (arg0)
> +                     && TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
>
> this check is redundant, too.

Good point - I will commit the patch below after another bootstrap and 
regtesting.

Tobias

arg0, n);
Richard Guenther - May 31, 2013, 8:58 a.m.
On Fri, May 31, 2013 at 10:57 AM, Tobias Burnus <burnus@net-b.de> wrote:
> Richard Biener wrote:
>>
>> Why sink the !host_integerp check?  Please keep it where it is now.
>> Then
>>
>> +                 if (real_minus_onep (arg0)
>> +                     && TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
>>
>> this check is redundant, too.
>
>
> Good point - I will commit the patch below after another bootstrap and
> regtesting.
>
> Tobias
>
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -1448,7 +1448,9 @@ execute_cse_sincos (void)
>                   loc = gimple_location (stmt);
>
>
> -                 if (real_minus_onep (arg0)
> -                     && TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
> -                     && !host_integerp (arg1,0))
>
> +                 if (!host_integerp (arg1, 0))
> +                   break;
> +
> +

Very too much vertical space here and above.

> +                 if (real_minus_onep (arg0))
>                     {
>                        tree t0, t1, cond, one, minus_one;
> @@ -1477,7 +1479,4 @@ execute_cse_sincos (void)
>                   else
>                     {
> -                     if (!host_integerp (arg1, 0))
> -                       break;
> -
>                       n = TREE_INT_CST_LOW (arg1);
>
>                       result = gimple_expand_builtin_powi (&gsi, loc, arg0,
> n);

Patch

--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1448,7 +1448,9 @@  execute_cse_sincos (void)
                   loc = gimple_location (stmt);

-                 if (real_minus_onep (arg0)
-                     && TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
-                     && !host_integerp (arg1,0))
+                 if (!host_integerp (arg1, 0))
+                   break;
+
+
+                 if (real_minus_onep (arg0))
                     {
                        tree t0, t1, cond, one, minus_one;
@@ -1477,7 +1479,4 @@  execute_cse_sincos (void)
                   else
                     {
-                     if (!host_integerp (arg1, 0))
-                       break;
-
                       n = TREE_INT_CST_LOW (arg1);
                       result = gimple_expand_builtin_powi (&gsi, loc,