On Fri, May 31, 2013 at 5:02 PM, Tobias Burnus <bur...@net-b.de> wrote:
> Am 31.05.2013 10:24, schrieb Richard Biener:
>>
>> On Thu, May 30, 2013 at 10:54 PM, Jeff Law <l...@redhat.com> wrote:
>>>
>>> Don't worry about it. The patch is good as-is.
>>
>> Why sink the !host_integerp check?  Please keep it where it is now.
>>
>
> Answer: Because it doesn't work. And if I had a cup of coffee and didn't
> mess up my regtesting (by excluding the newly added test case), I had also
> seen that.
>
> The very old code had (assume: powi(x,n)):
>   if (n is not a constant)
>     break;
>   expand powi to "n" multiplications.
>
> The original patch changed it to:
>
>   if (n is a not constant and x == -1)
>     result =  n & 1 ? -1.0 : 1.0
>   else
>     {
>       if (n is not a constant)
>         break;
>       expand powi to "n" multiplications.
>     }
>
> Thus, if one moves up the condition
>   if (n is not a constant)
>     break;
> the newly added code becomes unreachable.
>
> However, I think the code is more readable if one simply removes the "&&
> !host_integerp (arg1,0)" from the x==1 case. Due to fold_builtin_powi having
> x==-1 and n == const should not happen - and if, the "n & 1 ? -1.0 : 1.0" is
> also not worse than an expanded multiplication (if n is large).
> [Alternatively, one can also keep (re-add) the "&& !host_integerp
> (arg1,0)".]
>
> OK? (After successful bootstrap and regtesting.)

Ok.

Thanks,
Richard.

> Tobias

Reply via email to