diff options
author | Richard Henderson <rth@redhat.com> | 2002-09-04 16:21:28 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-09-04 16:21:28 -0700 |
commit | ab5e26156fb28eb59e0a259ccb0ab49485a1b94c (patch) | |
tree | 6a9e27455fe10ee403d06e599a3b61ab33cb8756 /gcc/builtins.c | |
parent | 9beb7d208292359f61d839fefa95153590df4200 (diff) | |
download | gcc-ab5e26156fb28eb59e0a259ccb0ab49485a1b94c.zip gcc-ab5e26156fb28eb59e0a259ccb0ab49485a1b94c.tar.gz gcc-ab5e26156fb28eb59e0a259ccb0ab49485a1b94c.tar.bz2 |
builtin-types.def (BT_FN_FLOAT): New.
* builtin-types.def (BT_FN_FLOAT): New.
(BT_FN_DOUBLE, BT_FN_LONG_DOUBLE): New.
* builtins.def (BUILT_IN_INF, BUILT_IN_INFF, BUILT_IN_INFL,
BUILT_IN_HUGE_VAL, BUILT_IN_HUGE_VALF, BUILT_IN_HUGE_VALL): New.
* builtins.c (fold_builtin_inf): New.
(fold_builtin): Call it.
* real.c (ereal_inf): New.
* real.h: Declare it.
* doc/extend.texi: Document new builtins.
From-SVN: r56820
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 b2ad537..7b2841b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -148,6 +148,7 @@ static tree stabilize_va_list PARAMS ((tree, int)); static rtx expand_builtin_expect PARAMS ((tree, rtx)); static tree fold_builtin_constant_p PARAMS ((tree)); static tree fold_builtin_classify_type PARAMS ((tree)); +static tree fold_builtin_inf PARAMS ((tree, int)); static tree build_function_call_expr PARAMS ((tree, tree)); static int validate_arglist PARAMS ((tree, ...)); @@ -4132,6 +4133,19 @@ fold_builtin_classify_type (arglist) return build_int_2 (type_to_class (TREE_TYPE (TREE_VALUE (arglist))), 0); } +/* Fold a call to __builtin_inf or __builtin_huge_val. */ + +static tree +fold_builtin_inf (type, warn) + tree type; + int warn; +{ + if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn) + warning ("target format does not support infinity"); + + return build_real (type, ereal_inf (TYPE_MODE (type))); +} + /* Used by constant folding to eliminate some builtin calls early. EXP is the CALL_EXPR of a call to a builtin function. */ @@ -4163,6 +4177,16 @@ fold_builtin (exp) } break; + case BUILT_IN_INF: + case BUILT_IN_INFF: + case BUILT_IN_INFL: + return fold_builtin_inf (TREE_TYPE (TREE_TYPE (fndecl)), true); + + case BUILT_IN_HUGE_VAL: + case BUILT_IN_HUGE_VALF: + case BUILT_IN_HUGE_VALL: + return fold_builtin_inf (TREE_TYPE (TREE_TYPE (fndecl)), false); + default: break; } |