Mercurial > hg > CbC > CbC_gcc
diff gcc/builtins.c @ 36:855418dad1a3
gcc-4.4-20091020
author | e075725 |
---|---|
date | Tue, 22 Dec 2009 21:19:31 +0900 |
parents | 58ad6c70ea60 |
children | 3bfb6c00c1e0 |
line wrap: on
line diff
--- a/gcc/builtins.c Thu Sep 24 13:21:57 2009 +0900 +++ b/gcc/builtins.c Tue Dec 22 21:19:31 2009 +0900 @@ -8634,15 +8634,18 @@ } } - /* Optimize pow(pow(x,y),z) = pow(x,y*z). */ + /* Optimize pow(pow(x,y),z) = pow(x,y*z) iff x is nonnegative. */ if (fcode == BUILT_IN_POW || fcode == BUILT_IN_POWF || fcode == BUILT_IN_POWL) { tree arg00 = CALL_EXPR_ARG (arg0, 0); - tree arg01 = CALL_EXPR_ARG (arg0, 1); - tree narg1 = fold_build2 (MULT_EXPR, type, arg01, arg1); - return build_call_expr (fndecl, 2, arg00, narg1); + if (tree_expr_nonnegative_p (arg00)) + { + tree arg01 = CALL_EXPR_ARG (arg0, 1); + tree narg1 = fold_build2 (MULT_EXPR, type, arg01, arg1); + return build_call_expr (fndecl, 2, arg00, narg1); + } } }