diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2006-10-24 21:52:51 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2006-10-24 21:52:51 +0000 |
commit | e4ef58afd46558f1e82c2d965c9bcdeb1ee47edb (patch) | |
tree | f4735e3149ffc1de2d71037195fc0bae3d0dbc06 | |
parent | b53fed56360bb38807b13ec7b3c83d34c6b0b81a (diff) | |
download | gcc-e4ef58afd46558f1e82c2d965c9bcdeb1ee47edb.zip gcc-e4ef58afd46558f1e82c2d965c9bcdeb1ee47edb.tar.gz gcc-e4ef58afd46558f1e82c2d965c9bcdeb1ee47edb.tar.bz2 |
builtin-math-2.c: Add checks for asin, acos, acosh and atanh.
* gcc.dg/torture/builtin-math-2.c: Add checks for asin, acos,
acosh and atanh.
* gcc.dg/torture/builtin-math-3.c (TESTIT): Append 'F' and 'L'
floating point modifiers to arguments passed to float and long
double functions respectively. Update all callers to use floating
point numbers, not integers. Add tests for exp, exp2 and
exp10/pow10.
From-SVN: r118012
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/builtin-math-2.c | 47 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/builtin-math-3.c | 82 |
3 files changed, 109 insertions, 29 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 97e3f75..b690347 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2006-10-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + * gcc.dg/torture/builtin-math-2.c: Add checks for asin, acos, + acosh and atanh. + + * gcc.dg/torture/builtin-math-3.c (TESTIT): Append 'F' and 'L' + floating point modifiers to arguments passed to float and long + double functions respectively. Update all callers to use floating + point numbers, not integers. Add tests for exp, exp2 and + exp10/pow10. + * gcc.dg/torture/builtin-math-3.c: New test. 2006-10-24 Erik Edelmann <eedelman@gcc.gnu.org> diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c index deeedf7..fff0e7a 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c @@ -1,7 +1,9 @@ -/* Test things that should block GCC from optimizing compile-time +/* Copyright (C) 2006 Free Software Foundation. + + Test things that should block GCC from optimizing compile-time constants passed to a builtin transcendental function. - Origin: Kaveh R. Ghazi 10/22/2006. */ + Origin: Kaveh R. Ghazi, October 22, 2006. */ /* { dg-do compile } */ /* { dg-options "-fdump-tree-original" } */ @@ -59,9 +61,50 @@ void bar() foof (__builtin_exp2f (-1.5F)); foo (__builtin_exp2 (-1.5)); fool (__builtin_exp2l (-1.5L)); + + /* The asin arg must be [-1 ... 1] inclusive. */ + foof (__builtin_asinf (-1.5F)); + foof (__builtin_asinf (1.5F)); + foo (__builtin_asin (-1.5)); + foo (__builtin_asin (1.5)); + fool (__builtin_asinl (-1.5L)); + fool (__builtin_asinl (1.5L)); + + /* The acos arg must be [-1 ... 1] inclusive. */ + foof (__builtin_acosf (-1.5F)); + foof (__builtin_acosf (1.5F)); + foo (__builtin_acos (-1.5)); + foo (__builtin_acos (1.5)); + fool (__builtin_acosl (-1.5L)); + fool (__builtin_acosl (1.5L)); + + /* The acosh arg must be [1 ... Inf] inclusive. */ + foof (__builtin_acoshf (0.5F)); + foo (__builtin_acosh (0.5)); + fool (__builtin_acoshl (0.5L)); + + /* The atanh arg must be [-1 ... 1] exclusive. */ + foof (__builtin_atanhf (-1.0F)); + foof (__builtin_atanhf (1.0F)); + foo (__builtin_atanh (-1.0)); + foo (__builtin_atanh (1.0)); + fool (__builtin_atanhl (-1.0L)); + fool (__builtin_atanhl (1.0L)); } /* { dg-final { scan-tree-dump-times "exp2 " 9 "original" } } */ /* { dg-final { scan-tree-dump-times "exp2f" 9 "original" } } */ /* { dg-final { scan-tree-dump-times "exp2l" 9 "original" } } */ +/* { dg-final { scan-tree-dump-times "asin " 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "asinf" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "asinl" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "acos " 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "acosf" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "acosl" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "acosh " 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "acoshf" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "acoshl" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "atanh " 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "atanhf" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "atanhl" 2 "original" } } */ /* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c index 60f030b..d50b227 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c @@ -3,7 +3,7 @@ Verify that built-in math function constant folding of constant arguments is correctly performed by the compiler. - Origin: Kaveh R. Ghazi, October 23, 2006. */ + Origin: Kaveh R. Ghazi, October 23, 2006. */ /* { dg-do link } */ @@ -12,11 +12,11 @@ extern void link_error(int); /* Test that FUNC(ARG) == (RES). */ #define TESTIT(FUNC,ARG,RES) do { \ - if (__builtin_##FUNC##f(ARG) != RES) \ + if (__builtin_##FUNC##f(ARG##F) != RES##F) \ link_error(__LINE__); \ if (__builtin_##FUNC(ARG) != RES) \ link_error(__LINE__); \ - if (__builtin_##FUNC##l(ARG) != RES) \ + if (__builtin_##FUNC##l(ARG##L) != RES##L) \ link_error(__LINE__); \ } while (0); @@ -32,40 +32,68 @@ extern void link_error(int); int main (void) { - TESTIT2 (asin, -1, -3.15/2, -3.14/2); /* asin(-1) == -pi/2 */ - TESTIT (asin, 0, 0); /* asin(0) == 0 */ - TESTIT2 (asin, 1, 3.14/2, 3.15/2); /* asin(1) == pi/2 */ + TESTIT2 (asin, -1.0, -3.15/2.0, -3.14/2.0); /* asin(-1) == -pi/2 */ + TESTIT (asin, 0.0, 0.0); /* asin(0) == 0 */ + TESTIT2 (asin, 1.0, 3.14/2.0, 3.15/2.0); /* asin(1) == pi/2 */ - TESTIT2 (acos, -1, 3.14, 3.15); /* acos(-1) == pi */ - TESTIT2 (acos, 0, 3.14/2, 3.15/2); /* acos(0) == pi/2 */ - TESTIT (acos, 1, 0); /* acos(1) == 0 */ + TESTIT2 (acos, -1.0, 3.14, 3.15); /* acos(-1) == pi */ + TESTIT2 (acos, 0.0, 3.14/2.0, 3.15/2.0); /* acos(0) == pi/2 */ + TESTIT (acos, 1.0, 0.0); /* acos(1) == 0 */ - TESTIT2 (atan, -1, -3.15/4, -3.14/4); /* atan(-1) == -pi/4 */ - TESTIT (atan, 0, 0); /* atan(0) == 0 */ - TESTIT2 (atan, 1, 3.14/4, 3.15/4); /* atan(1) == pi/4 */ + TESTIT2 (atan, -1.0, -3.15/4.0, -3.14/4.0); /* atan(-1) == -pi/4 */ + TESTIT (atan, 0.0, 0.0); /* atan(0) == 0 */ + TESTIT2 (atan, 1.0, 3.14/4.0, 3.15/4.0); /* atan(1) == pi/4 */ - TESTIT2 (asinh, -1, -0.89, -0.88); /* asinh(-1) == -0.881... */ - TESTIT (asinh, 0, 0); /* asinh(0) == 0 */ - TESTIT2 (asinh, 1, 0.88, 0.89); /* asinh(1) == 0.881... */ + TESTIT2 (asinh, -1.0, -0.89, -0.88); /* asinh(-1) == -0.881... */ + TESTIT (asinh, 0.0, 0.0); /* asinh(0) == 0 */ + TESTIT2 (asinh, 1.0, 0.88, 0.89); /* asinh(1) == 0.881... */ - TESTIT (acosh, 1, 0); /* acosh(1) == 0. */ - TESTIT2 (acosh, 2, 1.31, 1.32); /* acosh(2) == 1.316... */ + TESTIT (acosh, 1.0, 0.0); /* acosh(1) == 0. */ + TESTIT2 (acosh, 2.0, 1.31, 1.32); /* acosh(2) == 1.316... */ TESTIT2 (atanh, -0.5, -0.55, -0.54); /* atanh(-0.5) == -0.549... */ - TESTIT (atanh, 0, 0); /* atanh(0) == 0 */ + TESTIT (atanh, 0.0, 0.0); /* atanh(0) == 0 */ TESTIT2 (atanh, 0.5, 0.54, 0.55); /* atanh(0.5) == 0.549... */ - TESTIT2 (sinh, -1, -1.18, -1.17); /* sinh(-1) == -1.175... */ - TESTIT (sinh, 0, 0); /* sinh(0) == 0 */ - TESTIT2 (sinh, 1, 1.17, 1.18); /* sinh(1) == 1.175... */ + TESTIT2 (sin, -1.0, -0.85, -0.84); /* sin(-1) == -0.841... */ + TESTIT (sin, 0.0, 0.0); /* sin(0) == 0 */ + TESTIT2 (sin, 1.0, 0.84, 0.85); /* sin(1) == 0.841... */ - TESTIT2 (cosh, -1, 1.54, 1.55); /* cosh(-1) == 1.543... */ - TESTIT (cosh, 0, 1); /* cosh(0) == 1 */ - TESTIT2 (cosh, 1, 1.54, 1.55); /* cosh(1) == 1.543... */ + TESTIT2 (cos, -1.0, 0.54, 0.55); /* cos(-1) == 0.5403... */ + TESTIT (cos, 0.0, 1.0); /* cos(0) == 1 */ + TESTIT2 (cos, 1.0, 0.54, 0.55); /* cos(1) == 0.5403... */ - TESTIT2 (tanh, -1, -0.77, -0.76); /* tanh(-1) == -0.761... */ - TESTIT (tanh, 0, 0); /* tanh(0) == 0 */ - TESTIT2 (tanh, 1, 0.76, 0.77); /* tanh(1) == 0.761... */ + TESTIT2 (tan, -1.0, -1.56, 1.55); /* tan(-1) == -1.557... */ + TESTIT (tan, 0.0, 0.0); /* tan(0) == 0 */ + TESTIT2 (tan, 1.0, 1.55, 1.56); /* tan(1) == 1.557... */ + + TESTIT2 (sinh, -1.0, -1.18, -1.17); /* sinh(-1) == -1.175... */ + TESTIT (sinh, 0.0, 0.0); /* sinh(0) == 0 */ + TESTIT2 (sinh, 1.0, 1.17, 1.18); /* sinh(1) == 1.175... */ + + TESTIT2 (cosh, -1.0, 1.54, 1.55); /* cosh(-1) == 1.543... */ + TESTIT (cosh, 0.0, 1.0); /* cosh(0) == 1 */ + TESTIT2 (cosh, 1.0, 1.54, 1.55); /* cosh(1) == 1.543... */ + + TESTIT2 (tanh, -1.0, -0.77, -0.76); /* tanh(-1) == -0.761... */ + TESTIT (tanh, 0.0, 0.0); /* tanh(0) == 0 */ + TESTIT2 (tanh, 1.0, 0.76, 0.77); /* tanh(1) == 0.761... */ + + TESTIT2 (exp, -1.0, 0.36, 0.37); /* exp(-1) == 1/e */ + TESTIT (exp, 0.0, 1.0); /* exp(0) == 1 */ + TESTIT2 (exp, 1.0, 2.71, 2.72); /* exp(1) == e */ + + TESTIT (exp2, -1.0, 0.5); /* exp2(-1) == 1/2 */ + TESTIT (exp2, 0.0, 1.0); /* exp2(0) == 1 */ + TESTIT (exp2, 1.0, 2.0); /* exp2(1) == 2 */ + + TESTIT (exp10, -1.0, 0.1); /* exp10(-1) == 1/10 */ + TESTIT (exp10, 0.0, 1.0); /* exp10(0) == 1 */ + TESTIT (exp10, 1.0, 10.0); /* exp10(1) == 10 */ + + TESTIT (pow10, -1.0, 0.1); /* pow10(-1) == 1/10 */ + TESTIT (pow10, 0.0, 1.0); /* pow10(0) == 1 */ + TESTIT (pow10, 1.0, 10.0); /* pow10(1) == 10 */ return 0; } |