summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-31 15:06:19 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-31 15:06:19 +0000
commitb4e8ab0c6a2c824cacbbb668321232fbc84b5bd4 (patch)
treeb9b851f9784b75ef4fc4a39e72412270f9adf292 /gcc/testsuite
parent3bbbcdff3d9d98e86abbd8ce8090b8fbb518bfba (diff)
downloadgcc-b4e8ab0c6a2c824cacbbb668321232fbc84b5bd4.tar.gz
PR middle-end/29335
* builtins.c (fold_builtin_sqrt): Use MPFR for constant args. testsuite: * gcc.dg/torture/builtin-math-2.c: Add sqrt cases. * gcc.dg/torture/builtin-math-3.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121423 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-3.c7
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 137fea50e4f..b89e9859484 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/torture/builtin-math-2.c: Add sqrt cases.
+ * gcc.dg/torture/builtin-math-3.c: Likewise.
+
2007-01-31 Dirk Mueller <dmueller@suse.de>
gcc.dg/Wparentheses-2.c: Update and add new tests.
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
index f0dbf2e1151..23749927cc6 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
@@ -145,6 +145,11 @@ void bar()
fool (__builtin_fmal (__LDBL_MAX__, __LDBL_MAX__, 0.0L));
fool (__builtin_fmal (__LDBL_MAX__, 1.0L, __LDBL_MAX__));
fool (__builtin_fmal (__LDBL_MIN__, __LDBL_MIN__, 0.0L));
+
+ /* The sqrt arg must be [0 ... Inf] inclusive. */
+ TESTIT (sqrt, -0.5);
+ TESTIT (sqrt, -0.0);
+ TESTIT (sqrt, 0.0);
}
/* { dg-final { scan-tree-dump-times "exp2 " 9 "original" } } */
@@ -183,4 +188,7 @@ void bar()
/* { dg-final { scan-tree-dump-times "fma " 3 "original" } } */
/* { dg-final { scan-tree-dump-times "fmaf" 3 "original" } } */
/* { dg-final { scan-tree-dump-times "fmal" 3 "original" } } */
+/* { dg-final { scan-tree-dump-times "sqrt " 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "sqrtf" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "sqrtl" 1 "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 b347dccbecc..896edccaa7f 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c
@@ -363,5 +363,12 @@ int main (void)
if (__builtin_fmal(0.5L,__LDBL_MIN__, __LDBL_MIN__) != __LDBL_MIN__*1.5L)
link_error (__LINE__);
+ TESTIT (sqrt, -0.0, -0.0); /* sqrt(-0) == -0 */
+ TESTIT (sqrt, 0.0, 0.0); /* sqrt(0) == 0 */
+ TESTIT (sqrt, 1.0, 1.0); /* sqrt(1) == 1 */
+ TESTIT (sqrt, 4.0, 2.0); /* sqrt(4) == 2 */
+ TESTIT_R (sqrt, 1.5, 1.22, 1.23); /* sqrt(1.5) == 1.224... */
+ TESTIT_R (sqrt, 2.0, 1.41, 1.42); /* sqrt(2) == 1.414... */
+
return 0;
}