static tree
powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
- HOST_WIDE_INT n, tree *cache)
+ unsigned HOST_WIDE_INT n, tree *cache)
{
tree op0, op1, ssa_target;
unsigned HOST_WIDE_INT digit;
memset (cache, 0, sizeof (cache));
cache[1] = arg0;
- result = powi_as_mults_1 (gsi, loc, type, (n < 0) ? -n : n, cache);
+ result = powi_as_mults_1 (gsi, loc, type, absu_hwi (n), cache);
if (n >= 0)
return result;
gimple_expand_builtin_powi (gimple_stmt_iterator *gsi, location_t loc,
tree arg0, HOST_WIDE_INT n)
{
- /* Avoid largest negative number. */
- if (n != -n
- && ((n >= -1 && n <= 2)
- || (optimize_function_for_speed_p (cfun)
- && powi_cost (n) <= POWI_MAX_MULTS)))
+ if ((n >= -1 && n <= 2)
+ || (optimize_function_for_speed_p (cfun)
+ && powi_cost (n) <= POWI_MAX_MULTS))
return powi_as_mults (gsi, loc, arg0, n);
return NULL_TREE;