summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 13:32:32 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 13:32:32 +0000
commitfe5ad9266cba2cbb611a831aaac450d3f6decd0c (patch)
treea1dce161550e71aa81d0af00e118e4f68d907995 /gcc/fold-const.c
parent6715fbd40b05c43941c4d4e093cceb5345a695e7 (diff)
parent8c53c46cebf42cb4f4ac125ca6428c5e9b519f66 (diff)
downloadgcc-fe5ad9266cba2cbb611a831aaac450d3f6decd0c.tar.gz
Merge from trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@205111 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ce24f75712c..a25dfffc72e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -46,6 +46,9 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "flags.h"
#include "tree.h"
+#include "stor-layout.h"
+#include "calls.h"
+#include "tree-iterator.h"
#include "realmpfr.h"
#include "rtl.h"
#include "expr.h"
@@ -6580,7 +6583,7 @@ fold_single_bit_test (location_t loc, enum tree_code code,
&& wi::ltu_p (wi::to_widest (TREE_OPERAND (inner, 1)) + bitnum,
TYPE_PRECISION (type)))
{
- bitnum += TREE_INT_CST_LOW (TREE_OPERAND (inner, 1));
+ bitnum += tree_to_uhwi (TREE_OPERAND (inner, 1));
inner = TREE_OPERAND (inner, 0);
}
@@ -12546,8 +12549,8 @@ fold_binary_loc (location_t loc,
&& tree_fits_uhwi_p (TREE_OPERAND (arg0, 1))
&& tree_to_uhwi (TREE_OPERAND (arg0, 1)) < prec)
{
- HOST_WIDE_INT low = (tree_to_shwi (TREE_OPERAND (arg0, 1))
- + tree_to_shwi (arg1));
+ unsigned int low = (tree_to_uhwi (TREE_OPERAND (arg0, 1))
+ + tree_to_uhwi (arg1));
/* Deal with a OP (c1 + c2) being undefined but (a OP c1) OP c2
being well defined. */
@@ -12571,13 +12574,13 @@ fold_binary_loc (location_t loc,
if (((code == LSHIFT_EXPR && TREE_CODE (arg0) == RSHIFT_EXPR)
|| (TYPE_UNSIGNED (type)
&& code == RSHIFT_EXPR && TREE_CODE (arg0) == LSHIFT_EXPR))
- && tree_fits_shwi_p (arg1)
- && tree_to_shwi (arg1) < prec
- && tree_fits_shwi_p (TREE_OPERAND (arg0, 1))
- && tree_to_shwi (TREE_OPERAND (arg0, 1)) < prec)
+ && tree_fits_uhwi_p (arg1)
+ && tree_to_uhwi (arg1) < prec
+ && tree_fits_uhwi_p (TREE_OPERAND (arg0, 1))
+ && tree_to_uhwi (TREE_OPERAND (arg0, 1)) < prec)
{
- HOST_WIDE_INT low0 = tree_to_shwi (TREE_OPERAND (arg0, 1));
- HOST_WIDE_INT low1 = tree_to_shwi (arg1);
+ HOST_WIDE_INT low0 = tree_to_uhwi (TREE_OPERAND (arg0, 1));
+ HOST_WIDE_INT low1 = tree_to_uhwi (arg1);
tree lshift;
tree arg00;