From 087b03caccd74346e58bea10d9d8b07a4ccb3e90 Mon Sep 17 00:00:00 2001 From: zadeck Date: Mon, 23 Sep 2013 21:23:39 +0000 Subject: [PATCH] fix merge on wide-int branch git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@202845 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 40 ++++++++++--------------------------- gcc/genpreds.c | 4 ---- gcc/gimple-ssa-strength-reduction.c | 10 +++++----- gcc/postreload.c | 2 +- gcc/ubsan.c | 4 ++-- 5 files changed, 18 insertions(+), 42 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ab94704..18bd4a0 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9897,17 +9897,15 @@ exact_inverse (tree type, tree cst) /* Mask out the tz least significant bits of X of type TYPE where tz is the number of trailing zeroes in Y. */ -static double_int -mask_with_tz (tree type, double_int x, double_int y) +static wide_int +mask_with_tz (tree type, wide_int x, wide_int y) { - int tz = y.trailing_zeros (); - + int tz = wi::ctz (y); if (tz > 0) { - double_int mask; + wide_int mask; - mask = ~double_int::mask (tz); - mask = mask.ext (TYPE_PRECISION (type), TYPE_UNSIGNED (type)); + mask = wi::mask (tz, true, TYPE_PRECISION (type)); return mask & x; } return x; @@ -11276,7 +11274,7 @@ fold_binary_loc (location_t loc, == INTEGER_CST) { tree t = TREE_OPERAND (TREE_OPERAND (arg0, 0), 1); - double_int masked = mask_with_tz (type, c3, tree_to_double_int (t)); + wide_int masked = mask_with_tz (type, c3, t); try_simplify = (masked != c1); } @@ -11670,32 +11668,14 @@ fold_binary_loc (location_t loc, && TREE_CODE (arg0) == MULT_EXPR && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) { -<<<<<<< .working - int arg1tz = wi::ctz (TREE_OPERAND (arg0, 1)); - if (arg1tz > 0) - { - wide_int arg1mask, masked; - arg1mask = wi::mask (arg1tz, true, TYPE_PRECISION (type)); - masked = arg1mask & arg1; - if (masked == 0) - return omit_two_operands_loc (loc, type, build_zero_cst (type), - arg0, arg1); - else if (masked != arg1) - return fold_build2_loc (loc, code, type, op0, - wide_int_to_tree (type, masked)); - } -======= - double_int masked - = mask_with_tz (type, tree_to_double_int (arg1), - tree_to_double_int (TREE_OPERAND (arg0, 1))); + wide_int masked = mask_with_tz (type, arg1, TREE_OPERAND (arg0, 1)); - if (masked.is_zero ()) + if (masked == 0) return omit_two_operands_loc (loc, type, build_zero_cst (type), arg0, arg1); - else if (masked != tree_to_double_int (arg1)) + else if (masked != arg1) return fold_build2_loc (loc, code, type, op0, - double_int_to_tree (type, masked)); ->>>>>>> .merge-right.r202797 + wide_int_to_tree (type, masked)); } /* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M, diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 29fafbe..a130ace 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -809,11 +809,7 @@ add_constraint (const char *name, const char *regclass, if (is_const_int || is_const_dbl) { enum rtx_code appropriate_code -#if TARGET_SUPPORTS_WIDE_INT - = is_const_int ? CONST_INT : CONST_WIDE_INT; -#else = is_const_int ? CONST_INT : CONST_DOUBLE; -#endif /* Consider relaxing this requirement in the future. */ if (regclass || GET_CODE (exp) != AND diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 7a089cd..505b7d4 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -763,7 +763,7 @@ slsr_process_phi (gimple phi, bool speed) int (i * S). Otherwise, just return double int zero. */ -static double_int +static max_wide_int backtrace_base_for_ref (tree *pbase) { tree base_in = *pbase; @@ -771,19 +771,19 @@ backtrace_base_for_ref (tree *pbase) STRIP_NOPS (base_in); if (TREE_CODE (base_in) != SSA_NAME) - return tree_to_double_int (integer_zero_node); + return 0; base_cand = base_cand_from_table (base_in); while (base_cand && base_cand->kind != CAND_PHI) { if (base_cand->kind == CAND_ADD - && base_cand->index.is_one () + && base_cand->index == 1 && TREE_CODE (base_cand->stride) == INTEGER_CST) { /* X = B + (1 * S), S is integer constant. */ *pbase = base_cand->base_expr; - return tree_to_double_int (base_cand->stride); + return base_cand->stride; } else if (base_cand->kind == CAND_ADD && TREE_CODE (base_cand->stride) == INTEGER_CST @@ -800,7 +800,7 @@ backtrace_base_for_ref (tree *pbase) base_cand = NULL; } - return tree_to_double_int (integer_zero_node); + return 0; } /* Look for the following pattern: diff --git a/gcc/postreload.c b/gcc/postreload.c index 6ac5bb3..b562d1f 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -305,7 +305,7 @@ reload_cse_simplify_set (rtx set, rtx insn) case ZERO_EXTEND: result = wide_int (std::make_pair (this_rtx, GET_MODE (src))); if (GET_MODE_PRECISION (GET_MODE (src)) > GET_MODE_PRECISION (word_mode)) - result = result.zext (GET_MODE_PRECISION (word_mode)); + result = wi::zext (result, GET_MODE_PRECISION (word_mode)); break; case SIGN_EXTEND: result = wide_int (std::make_pair (this_rtx, GET_MODE (src))); diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 6c6fea8..e0e6b5b 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -233,8 +233,8 @@ ubsan_source_location (location_t loc) static unsigned short get_ubsan_type_info_for_type (tree type) { - gcc_assert (TYPE_SIZE (type) && host_integerp (TYPE_SIZE (type), 1)); - int prec = exact_log2 (tree_low_cst (TYPE_SIZE (type), 1)); + gcc_assert (TYPE_SIZE (type) && tree_fits_uhwi_p (TYPE_SIZE (type))); + int prec = exact_log2 (tree_to_uhwi (TYPE_SIZE (type))); gcc_assert (prec != -1); return (prec << 1) | !TYPE_UNSIGNED (type); } -- 2.7.4