diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-03 21:33:57 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-03 21:33:57 +0000 |
commit | 67c65562f54b79711c2faccaebb6faa31fdbdd4f (patch) | |
tree | 09c0fbd9595e9411be41c39493368c74ad3a13be /gcc/tree.c | |
parent | e0820f9b2ce32cdd93ad566100054d50bc3f542a (diff) | |
download | gcc-67c65562f54b79711c2faccaebb6faa31fdbdd4f.tar.gz |
PR optimization/9325, PR java/6391
* fold-const.c (fold_convert): For floating point to integer
conversions, return the maximum/minimum representable integer
value if the real constant overflows the destination type.
* tree.c (real_value_from_int_cst): Allow the type to be NULL,
meaning don't truncate the result to a floating point mode.
Simplify the logic by calling real_from_integer directly.
* simplify-rtx.c (simplify_unary_operation): Implement the
same semantics for folding floating point to integer conversions
in RTL.
* gcc.c-torture/execute/20031003-1.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72079 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index b82a6bf6965..c83b24052b6 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -488,7 +488,7 @@ build_real (tree type, REAL_VALUE_TYPE d) and whose value is the integer value of the INTEGER_CST node I. */ REAL_VALUE_TYPE -real_value_from_int_cst (tree type ATTRIBUTE_UNUSED, tree i) +real_value_from_int_cst (tree type, tree i) { REAL_VALUE_TYPE d; @@ -496,12 +496,9 @@ real_value_from_int_cst (tree type ATTRIBUTE_UNUSED, tree i) bitwise comparisons to see if two values are the same. */ memset (&d, 0, sizeof d); - if (! TREE_UNSIGNED (TREE_TYPE (i))) - REAL_VALUE_FROM_INT (d, TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i), - TYPE_MODE (type)); - else - REAL_VALUE_FROM_UNSIGNED_INT (d, TREE_INT_CST_LOW (i), - TREE_INT_CST_HIGH (i), TYPE_MODE (type)); + real_from_integer (&d, type ? TYPE_MODE (type) : VOIDmode, + TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i), + TREE_UNSIGNED (TREE_TYPE (i))); return d; } |