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

Jeff Law law@redhat.com
Thu May 30 20:54:00 GMT 2013


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.



Jeff



More information about the Gcc-patches mailing list