diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2007-07-18 17:30:38 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2007-07-18 17:30:38 +0000 |
commit | 7faa1bbb5d0206cc83f20c1145f612f7754fdcf3 (patch) | |
tree | eb2db58c64bbaba8f0181d8d24ef99a386911de5 /gcc/builtins.c | |
parent | b5d32c25372d1e0604bbd8471d735e46215dbe03 (diff) | |
download | gcc-7faa1bbb5d0206cc83f20c1145f612f7754fdcf3.zip gcc-7faa1bbb5d0206cc83f20c1145f612f7754fdcf3.tar.gz gcc-7faa1bbb5d0206cc83f20c1145f612f7754fdcf3.tar.bz2 |
re PR target/30652 (SSE expansion is missing for isinf() and other fpclassify functions)
PR target/30652
PR middle-end/20558
* builtins.c (expand_builtin_interclass_mathfn): Provide a
generic fallback for isinf.
* c-cppbuiltin.c (builtin_define_float_constants): Move FP max
calculation code ...
* real.c (get_max_float): ... to here.
* real.h (get_max_float): New.
testsuite:
* gcc.dg/pr28796-1.c: Add more cases.
* gcc.dg/pr28796-2.c: Likewise.
From-SVN: r126724
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 44cfc0d..e92e56f 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2275,6 +2275,30 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget) return target; } + /* If there is no optab, try generic code. */ + switch (DECL_FUNCTION_CODE (fndecl)) + { + tree result; + + CASE_FLT_FN (BUILT_IN_ISINF): + { + /* isinf(x) -> isgreater(fabs(x),DBL_MAX). */ + tree const isgr_fn = built_in_decls[BUILT_IN_ISGREATER]; + tree const type = TREE_TYPE (arg); + REAL_VALUE_TYPE r; + char buf[128]; + + get_max_float (REAL_MODE_FORMAT (mode), buf, sizeof (buf)); + real_from_string (&r, buf); + result = build_call_expr (isgr_fn, 2, + fold_build1 (ABS_EXPR, type, arg), + build_real (type, r)); + return expand_expr (result, target, VOIDmode, EXPAND_NORMAL); + } + default: + break; + } + target = expand_call (exp, target, target == const0_rtx); return target; |