summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr28796-2.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-18 17:51:13 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-18 17:51:13 +0000
commit8a1a9cb734099d5ede9ff1358a56ca0d86e1fdb6 (patch)
tree9ffecaf26eda365c1b062b84581aba0966791c13 /gcc/testsuite/gcc.dg/pr28796-2.c
parentcde061c1eeae4f2d96c6e9d4bcaaaaaa320380aa (diff)
downloadgcc-8a1a9cb734099d5ede9ff1358a56ca0d86e1fdb6.tar.gz
PR target/30652
* builtins.c (expand_builtin_interclass_mathfn): Provide a generic transformation for builtin ISNORMAL. (expand_builtin): Handle BUILT_IN_ISNORMAL. * builtins.def (BUILT_IN_ISNORMAL): New. * doc/extend.texi: Document isnormal. testsuite: * gcc.dg/pr28796-2.c: Add more cases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126726 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr28796-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr28796-2.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/testsuite/gcc.dg/pr28796-2.c b/gcc/testsuite/gcc.dg/pr28796-2.c
index 6f929a81fd6..c69a60e0c4a 100644
--- a/gcc/testsuite/gcc.dg/pr28796-2.c
+++ b/gcc/testsuite/gcc.dg/pr28796-2.c
@@ -6,7 +6,8 @@ extern void abort (void);
void __attribute__ ((__noinline__))
foo_1 (float f, double d, long double ld,
- int res_unord, int res_isnan, int res_isinf, int res_isfin)
+ int res_unord, int res_isnan, int res_isinf,
+ int res_isfin, int res_isnorm)
{
if (__builtin_isunordered (f, 0) != res_unord)
abort ();
@@ -43,6 +44,13 @@ foo_1 (float f, double d, long double ld,
if (__builtin_isinfl (ld) != res_isinf)
abort ();
+ if (__builtin_isnormal (f) != res_isnorm)
+ abort ();
+ if (__builtin_isnormal (d) != res_isnorm)
+ abort ();
+ if (__builtin_isnormal (ld) != res_isnorm)
+ abort ();
+
if (__builtin_isfinite (f) != res_isfin)
abort ();
if (__builtin_isfinite (d) != res_isfin)
@@ -64,10 +72,12 @@ foo_1 (float f, double d, long double ld,
void __attribute__ ((__noinline__))
foo (float f, double d, long double ld,
- int res_unord, int res_isnan, int res_isinf, int res_isfin)
+ int res_unord, int res_isnan, int res_isinf,
+ int res_isfin, int res_isnorm)
{
- foo_1 (f, d, ld, res_unord, res_isnan, res_isinf, res_isfin);
- foo_1 (-f, -d, -ld, res_unord, res_isnan, res_isinf, res_isfin);
+ foo_1 (f, d, ld, res_unord, res_isnan, res_isinf, res_isfin, res_isnorm);
+ /* Try all values negative as well. */
+ foo_1 (-f, -d, -ld, res_unord, res_isnan, res_isinf, res_isfin, res_isnorm);
}
int main()
@@ -77,19 +87,28 @@ int main()
long double ld;
f = __builtin_nanf(""); d = __builtin_nan(""); ld = __builtin_nanl("");
- foo(f, d, ld, /*unord=*/ 1, /*isnan=*/ 1, /*isinf=*/ 0, /*isfin=*/ 0);
+ foo(f, d, ld, /*unord=*/ 1, /*isnan=*/ 1, /*isinf=*/ 0, /*isfin=*/ 0, /*isnorm=*/ 0);
f = __builtin_inff(); d = __builtin_inf(); ld = __builtin_infl();
- foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 1, /*isfin=*/ 0);
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 1, /*isfin=*/ 0, /*isnorm=*/ 0);
f = 0; d = 0; ld = 0;
- foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1);
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 0);
+
+ f = 1; d = 1; ld = 1;
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1);
f = __FLT_MIN__; d = __DBL_MIN__; ld = __LDBL_MIN__;
- foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1);
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1);
+
+ f = __FLT_MIN__/2; d = __DBL_MIN__/2; ld = __LDBL_MIN__/2;
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 0);
f = __FLT_MAX__; d = __DBL_MAX__; ld = __LDBL_MAX__;
- foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1);
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1);
+
+ f = __FLT_MAX__*2; d = __DBL_MAX__*2; ld = __LDBL_MAX__*2;
+ foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 1, /*isfin=*/ 0, /*isnorm=*/ 0);
return 0;
}