diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-04 23:21:28 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-04 23:21:28 +0000 |
commit | 92c43e3c28dbea747e0234ef4815971cb703be9b (patch) | |
tree | 6a9e27455fe10ee403d06e599a3b61ab33cb8756 /gcc/builtins.c | |
parent | 38b13a9b08d5ed6aaf64fe826f1e395570ab4ff8 (diff) | |
download | gcc-92c43e3c28dbea747e0234ef4815971cb703be9b.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56820 138bc75d-0d04-0410-961f-82ee72b054a4
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 b2ad5375b77..7b2841bcae9 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; } |