diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-06 12:36:26 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-06 12:36:26 +0000 |
commit | c63f4ad3b3e671a03a72dfa442f1098410dc8c9f (patch) | |
tree | 853d13ba808d4dc5f75ea461cff59feb4787b64b /gcc/testsuite/gcc.dg/builtins-2.c | |
parent | e57a83c215d3c9fd4df98757794848c69fea881b (diff) | |
download | gcc-c63f4ad3b3e671a03a72dfa442f1098410dc8c9f.tar.gz |
* fold-const.c (fold <ABS_EXPR>): Re-fold the result of folding
fabs(-x) into fabs(x). Use tree_expr_nonnegative_p to determine
when the ABS_EXPR (fabs or abs) is not required.
(tree_expr_nonnegative_p): Move the logic that sqrt and exp are
always nonnegative from fold to here. Additionally, cabs and fabs
are always non-negative, and pow and atan are non-negative if
their first argument is non-negative.
* builtins.c (fold_builtin_cabs): New function to fold cabs{,f,l}.
Evaluate cabs of a constant at compile-time. Convert cabs of a
non-complex argument into fabs. Convert cabs(z) into
sqrt(z.r*z.r + z.i*z.i) at the tree-level with -ffast-math or
-funsafe-math-optimizations or -ffast-math.
(fold_builtin): Convert BUILT_IN_FABS{,F,L} into an ABS_EXPR.
Fold BUILT_IN_CABS{,F,L} using fold_builtin_cabs.
* gcc.dg/builtins-2.c: Add some more tests.
* gcc.dg/builtins-18.c: New test case.
* gcc.dg/builtins-19.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-2.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-2.c b/gcc/testsuite/gcc.dg/builtins-2.c index ebd054f229a..895b80a2ef9 100644 --- a/gcc/testsuite/gcc.dg/builtins-2.c +++ b/gcc/testsuite/gcc.dg/builtins-2.c @@ -58,6 +58,21 @@ double test10(double x) return tan(atan(x)); } +double test11(double x) +{ + return fabs(fabs(x)); +} + +double test12(double x) +{ + return fabs(atan(x)); +} + +double test13(double x) +{ + return fabs(pow(2.0,x)); +} + float test1f(float x) { return logf(expf(x)); @@ -108,6 +123,21 @@ float test10f(float x) return tanf(atanf(x)); } +floatf test11f(float x) +{ + return fabsf(fabsf(x)); +} + +floatf test12f(float x) +{ + return fabsf(atanf(x)); +} + +float test13f(float x) +{ + return fabsf(powf(2.0f,x)); +} + long double test1l(long double x) { return logl(expl(x)); @@ -158,3 +188,18 @@ long double test10l(long double x) return tanl(atanl(x)); } +long double test11l(long double x) +{ + return fabsl(fabsl(x)); +} + +long double test12l(long double x) +{ + return fabsl(atanl(x)); +} + +long double test13l(long double x) +{ + return fabsl(powl(2.0l,x)); +} + |