summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 14:30:01 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 14:30:01 +0000
commit481e2176f6a0802cd8b59023aa3c255be8a881cc (patch)
tree7c7210f4549be75f441d52b520c2b2fdfed071ef /gcc/convert.c
parent7f93d5de51bc21d4a179edf7a3240ae5fadc0562 (diff)
downloadgcc-481e2176f6a0802cd8b59023aa3c255be8a881cc.tar.gz
2012-03-07 Richard Guenther <rguenther@suse.de>
* convert.c (strip_float_extensions): Move ... * tree.c (strip_float_extensions): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185046 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index dbe2c7eb32e..dc9b7f29ea4 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -90,52 +90,6 @@ convert_to_pointer (tree type, tree expr)
}
}
-/* Avoid any floating point extensions from EXP. */
-tree
-strip_float_extensions (tree exp)
-{
- tree sub, expt, subt;
-
- /* For floating point constant look up the narrowest type that can hold
- it properly and handle it like (type)(narrowest_type)constant.
- This way we can optimize for instance a=a*2.0 where "a" is float
- but 2.0 is double constant. */
- if (TREE_CODE (exp) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (TREE_TYPE (exp)))
- {
- REAL_VALUE_TYPE orig;
- tree type = NULL;
-
- orig = TREE_REAL_CST (exp);
- if (TYPE_PRECISION (TREE_TYPE (exp)) > TYPE_PRECISION (float_type_node)
- && exact_real_truncate (TYPE_MODE (float_type_node), &orig))
- type = float_type_node;
- else if (TYPE_PRECISION (TREE_TYPE (exp))
- > TYPE_PRECISION (double_type_node)
- && exact_real_truncate (TYPE_MODE (double_type_node), &orig))
- type = double_type_node;
- if (type)
- return build_real (type, real_value_truncate (TYPE_MODE (type), orig));
- }
-
- if (!CONVERT_EXPR_P (exp))
- return exp;
-
- sub = TREE_OPERAND (exp, 0);
- subt = TREE_TYPE (sub);
- expt = TREE_TYPE (exp);
-
- if (!FLOAT_TYPE_P (subt))
- return exp;
-
- if (DECIMAL_FLOAT_TYPE_P (expt) != DECIMAL_FLOAT_TYPE_P (subt))
- return exp;
-
- if (TYPE_PRECISION (subt) > TYPE_PRECISION (expt))
- return exp;
-
- return strip_float_extensions (sub);
-}
-
/* Convert EXPR to some floating-point type TYPE.