(expand_builtin): Use it to expand lrint instead of
expand_builtin_mathfn.
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/28252
+ * builtins.c (fold_builtin): Fold pow(x,1.0/3.0) as cbrt(x) if
+ flag_unsafe_math_optimizations is set.
+
2006-10-21 Uros Bizjak <uros@kss-loka.si>
PR target/19398
}
}
+ /* Optimize pow(x,1.0/3.0) = cbrt(x). */
+ if (flag_unsafe_math_optimizations)
+ {
+ const REAL_VALUE_TYPE dconstroot
+ = real_value_truncate (TYPE_MODE (type), dconstthird);
+
+ if (REAL_VALUES_EQUAL (c, dconstroot))
+ {
+ tree cbrtfn = mathfn_built_in (type, BUILT_IN_CBRT);
+ if (cbrtfn != NULL_TREE)
+ {
+ tree arglist = build_tree_list (NULL_TREE, arg0);
+ return build_function_call_expr (cbrtfn, arglist);
+ }
+ }
+ }
+
/* Check for an integer exponent. */
n = real_to_integer (&c);
real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0);
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/28252
+ * gcc.dg/builtins-8.c: Also check pow(x,1.0/3.0) to cbrt(x)
+ transformation.
+
2006-10-21 Richard Guenther <rguenther@suse.de>
PR tree-optimization/3511
-/* Copyright (C) 2003 Free Software Foundation.
+/* Copyright (C) 2003, 2006 Free Software Foundation.
Verify that built-in math function constant folding of functions
with one constant argument is correctly performed by the compiler.
extern void abort(void);
extern double pow(double, double);
extern double sqrt(double);
+extern double cbrt(double);
void test(double x)
{
if (pow(x,0.5) != sqrt(x))
abort ();
+
+ if (pow(x,1.0/3.0) != cbrt(x))
+ abort ();
}
int main()