PR57073 - Optimize __builtin_powif (-1.0, k) to k & 1 ? -1.0 : 1.0
Richard Biener
richard.guenther@gmail.com
Fri May 31 08:24:00 GMT 2013
On Thu, May 30, 2013 at 10:54 PM, Jeff Law <law@redhat.com> wrote:
> On 05/30/2013 02:38 PM, Tobias Burnus wrote:
>>
>>
>> I am a bit lost. The code quoted above is the old code - just moved down
>> a bit. It is supposed to handle powi(x,n) for unknown x with known n -
>> while the new code handles x == -1.0 for unknown n. Thus,
>> gimple_expand_builtin_powi should be unreachable for x == -1.
>
> Sorry, I misread the patch. I was focused on the new lines and never
> looked back up to see if they were just copied from before.
>
>
>
>>
>> If I understood it correctly, you would like to have an additional case
>> before the newly added "k == 1", which does something like:
>>
>> result = fold_builtin_powi (loc, NULL_TREE, arg1, arg2, TREE_TYPE (arg1);
>>
>> if (result != NULL_TREE && .... /* Newly added x == -1.0 case. */
>>
>> Is that what you propose?
>
> Don't worry about it. The patch is good as-is.
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.
Richard.
>
>
> Jeff
>
More information about the Gcc-patches
mailing list