diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-11-07 10:05:51 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-11-07 10:05:51 +0000 |
commit | 2556a032cc18bb71c85988967fed074528fb5030 (patch) | |
tree | 94dd631ff29bdbed21c2b63a6d9ae302de5441f7 /gcc/fold-const-call.c | |
parent | 5486d91300d0540215978ecde30870e1a337910c (diff) | |
download | gcc-2556a032cc18bb71c85988967fed074528fb5030.zip gcc-2556a032cc18bb71c85988967fed074528fb5030.tar.gz gcc-2556a032cc18bb71c85988967fed074528fb5030.tar.bz2 |
Handle constant fp classifications in fold-const-call.c
Move the constant "is finite", "is infinite" and "is nan" queries
to fold-const-call.c.
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
gcc/
* builtins.c (fold_builtin_classify): Move constant cases to...
* fold-const-call.c (fold_const_call_ss): ...here.
From-SVN: r229920
Diffstat (limited to 'gcc/fold-const-call.c')
-rw-r--r-- | gcc/fold-const-call.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/fold-const-call.c b/gcc/fold-const-call.c index 5af2c63..c277d2b 100644 --- a/gcc/fold-const-call.c +++ b/gcc/fold-const-call.c @@ -736,6 +736,31 @@ fold_const_call_ss (wide_int *result, built_in_function fn, /* Not yet folded to a constant. */ return false; + CASE_FLT_FN (BUILT_IN_FINITE): + case BUILT_IN_FINITED32: + case BUILT_IN_FINITED64: + case BUILT_IN_FINITED128: + case BUILT_IN_ISFINITE: + *result = wi::shwi (real_isfinite (arg) ? 1 : 0, precision); + return true; + + CASE_FLT_FN (BUILT_IN_ISINF): + case BUILT_IN_ISINFD32: + case BUILT_IN_ISINFD64: + case BUILT_IN_ISINFD128: + if (real_isinf (arg)) + *result = wi::shwi (arg->sign ? -1 : 1, precision); + else + *result = wi::shwi (0, precision); + return true; + + CASE_FLT_FN (BUILT_IN_ISNAN): + case BUILT_IN_ISNAND32: + case BUILT_IN_ISNAND64: + case BUILT_IN_ISNAND128: + *result = wi::shwi (real_isnan (arg) ? 1 : 0, precision); + return true; + default: return false; } |