This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR57073 - Optimize __builtin_powif (-1.0, k) to k & 1 ? -1.0 : 1.0
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Tobias Burnus <burnus at net-b dot de>, gcc patches <gcc-patches at gcc dot gnu dot org>, Thomas Koenig <tkoenig at netcologne dot de>
- Date: Fri, 31 May 2013 10:24:22 +0200
- Subject: Re: PR57073 - Optimize __builtin_powif (-1.0, k) to k & 1 ? -1.0 : 1.0
- References: <51A79580 dot 2010001 at net-b dot de> <51A79A25 dot 6080607 at redhat dot com> <51A7B8D7 dot 2010001 at net-b dot de> <51A7BC87 dot 1030801 at redhat dot com>
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
>