summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/gcc-interface/cuintp.c2
-rw-r--r--gcc/expmed.c2
-rw-r--r--gcc/fold-const.c5
-rw-r--r--gcc/predict.c27
-rw-r--r--gcc/real.c2
-rw-r--r--gcc/tree-chrec.c9
-rw-r--r--gcc/varasm.c2
7 files changed, 23 insertions, 26 deletions
diff --git a/gcc/ada/gcc-interface/cuintp.c b/gcc/ada/gcc-interface/cuintp.c
index e9b30b28aa5..367e387858f 100644
--- a/gcc/ada/gcc-interface/cuintp.c
+++ b/gcc/ada/gcc-interface/cuintp.c
@@ -160,7 +160,7 @@ UI_From_gnu (tree Input)
in a signed 64-bit integer. */
if (tree_fits_shwi_p (Input))
return UI_From_Int (tree_to_shwi (Input));
- else if (wi::lts_p (Input, 0) && TYPE_UNSIGNED (gnu_type))
+ else if (wi::neg_p (Input) && TYPE_UNSIGNED (gnu_type))
return No_Uint;
#endif
diff --git a/gcc/expmed.c b/gcc/expmed.c
index cffceb2c4a0..e76b6fcc724 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -4971,7 +4971,7 @@ make_tree (tree type, rtx x)
return t;
case CONST_DOUBLE:
- gcc_assert (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT);
+ STATIC_ASSERT (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT);
if (TARGET_SUPPORTS_WIDE_INT == 0 && GET_MODE (x) == VOIDmode)
t = wide_int_to_tree (type,
wide_int::from_array (&CONST_DOUBLE_LOW (x), 2,
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 3a5237d0e5c..7ee0bce5a76 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4274,9 +4274,8 @@ build_range_check (location_t loc, tree type, tree exp, int in_p,
if (integer_onep (low) && TREE_CODE (high) == INTEGER_CST)
{
int prec = TYPE_PRECISION (etype);
- wide_int osb = wi::set_bit_in_zero (prec - 1, prec) - 1;
- if (osb == high)
+ if (wi::mask (prec - 1, false, prec) == high)
{
if (TYPE_UNSIGNED (etype))
{
@@ -12950,7 +12949,7 @@ fold_binary_loc (location_t loc,
&& operand_equal_p (tree_strip_nop_conversions (TREE_OPERAND (arg0,
1)),
arg1, 0)
- && wi::bit_and (TREE_OPERAND (arg0, 0), 1) == 1)
+ && wi::extract_uhwi (TREE_OPERAND (arg0, 0), 0, 1) == 1)
{
return omit_two_operands_loc (loc, type,
code == NE_EXPR
diff --git a/gcc/predict.c b/gcc/predict.c
index c9c106606e7..d8669e39327 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1309,33 +1309,34 @@ predict_iv_comparison (struct loop *loop, basic_block bb,
bool overflow, overall_overflow = false;
widest_int compare_count, tem;
- widest_int loop_bound = wi::to_widest (loop_bound_var);
- widest_int compare_bound = wi::to_widest (compare_var);
- widest_int base = wi::to_widest (compare_base);
- widest_int compare_step = wi::to_widest (compare_step_var);
-
/* (loop_bound - base) / compare_step */
- tem = wi::sub (loop_bound, base, SIGNED, &overflow);
+ tem = wi::sub (wi::to_widest (loop_bound_var),
+ wi::to_widest (compare_base), SIGNED, &overflow);
overall_overflow |= overflow;
- widest_int loop_count = wi::div_trunc (tem, compare_step, SIGNED,
- &overflow);
+ widest_int loop_count = wi::div_trunc (tem,
+ wi::to_widest (compare_step_var),
+ SIGNED, &overflow);
overall_overflow |= overflow;
- if (!wi::neg_p (compare_step)
+ if (!wi::neg_p (wi::to_widest (compare_step_var))
^ (compare_code == LT_EXPR || compare_code == LE_EXPR))
{
/* (loop_bound - compare_bound) / compare_step */
- tem = wi::sub (loop_bound, compare_bound, SIGNED, &overflow);
+ tem = wi::sub (wi::to_widest (loop_bound_var),
+ wi::to_widest (compare_var), SIGNED, &overflow);
overall_overflow |= overflow;
- compare_count = wi::div_trunc (tem, compare_step, SIGNED, &overflow);
+ compare_count = wi::div_trunc (tem, wi::to_widest (compare_step_var),
+ SIGNED, &overflow);
overall_overflow |= overflow;
}
else
{
/* (compare_bound - base) / compare_step */
- tem = wi::sub (compare_bound, base, SIGNED, &overflow);
+ tem = wi::sub (wi::to_widest (compare_var),
+ wi::to_widest (compare_base), SIGNED, &overflow);
overall_overflow |= overflow;
- compare_count = wi::div_trunc (tem, compare_step, SIGNED, &overflow);
+ compare_count = wi::div_trunc (tem, wi::to_widest (compare_step_var),
+ SIGNED, &overflow);
overall_overflow |= overflow;
}
if (compare_code == LE_EXPR || compare_code == GE_EXPR)
diff --git a/gcc/real.c b/gcc/real.c
index a5e396e0471..f8e8d7fdfd9 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1446,7 +1446,7 @@ real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision)
w = SIGSZ * HOST_BITS_PER_LONG + words * HOST_BITS_PER_WIDE_INT;
tmp = real_int::from_array
(val, (w + HOST_BITS_PER_WIDE_INT - 1) / HOST_BITS_PER_WIDE_INT, w);
- tmp = wi::lrshift<real_int> (tmp, (words * HOST_BITS_PER_WIDE_INT) - exp);
+ tmp = wi::lrshift (tmp, (words * HOST_BITS_PER_WIDE_INT) - exp);
result = wide_int::from (tmp, precision, UNSIGNED);
if (r->sign)
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 972fac0ebf8..c78d9410429 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -490,21 +490,18 @@ tree_fold_binomial (tree type, tree n, unsigned int k)
if (k == 1)
return fold_convert (type, n);
- /* Numerator = n. */
- wide_int num = n;
-
/* Check that k <= n. */
- if (wi::ltu_p (num, k))
+ if (wi::ltu_p (n, k))
return NULL_TREE;
/* Denominator = 2. */
wide_int denom = wi::two (TYPE_PRECISION (TREE_TYPE (n)));
/* Index = Numerator-1. */
- wide_int idx = num - 1;
+ wide_int idx = wi::sub (n, 1);
/* Numerator = Numerator*Index = n*(n-1). */
- num = wi::smul (num, idx, &overflow);
+ wide_int num = wi::smul (n, idx, &overflow);
if (overflow)
return NULL_TREE;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 796b36d3d58..f8930b989b8 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4898,7 +4898,7 @@ output_constructor_regular_field (oc_local_state *local)
offset_int idx = wi::sext (wi::to_offset (local->index)
- wi::to_offset (local->min_index), prec);
fieldpos = (idx * wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (local->val))))
- .to_shwi ();
+ .to_short_addr ();
}
else if (local->field != NULL_TREE)
fieldpos = int_byte_position (local->field);