From 2be65d9e98a1335e0d948c2de59946e715afcbe5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 21 Aug 2017 14:50:56 +0000 Subject: Add a type_has_mode_precision_p helper function ...to replace instances of: TYPE_PRECISION (t) == GET_MODE_PRECISION (TYPE_MODE (t)) These conditions would need to be rewritten with variable-sized modes anyway. 2017-08-21 Richard Sandiford gcc/ * tree.h (type_has_mode_precision_p): New function. * convert.c (convert_to_integer_1): Use it. * expr.c (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * fold-const.c (fold_single_bit_test_into_sign_test): Likewise. * match.pd: Likewise. * tree-ssa-forwprop.c (simplify_rotate): Likewise. * tree-ssa-math-opts.c (convert_mult_to_fma): Likewise. * tree-tailcall.c (process_assignment): Likewise. * tree-vect-loop.c (vectorizable_reduction): Likewise. * tree-vect-patterns.c (vect_recog_vector_vector_shift_pattern) (vect_recog_mult_pattern, vect_recog_divmod_pattern): Likewise. * tree-vect-stmts.c (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. * tree-vrp.c (register_edge_assert_for_2): Likewise. From-SVN: r251231 --- gcc/tree-ssa-forwprop.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'gcc/tree-ssa-forwprop.c') diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 5719b99..5296206 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1529,7 +1529,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) /* Only create rotates in complete modes. Other cases are not expanded properly. */ if (!INTEGRAL_TYPE_P (rtype) - || TYPE_PRECISION (rtype) != GET_MODE_PRECISION (TYPE_MODE (rtype))) + || !type_has_mode_precision_p (rtype)) return false; for (i = 0; i < 2; i++) @@ -1609,8 +1609,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) && INTEGRAL_TYPE_P (TREE_TYPE (cdef_arg1[i])) && TYPE_PRECISION (TREE_TYPE (cdef_arg1[i])) > floor_log2 (TYPE_PRECISION (rtype)) - && TYPE_PRECISION (TREE_TYPE (cdef_arg1[i])) - == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (cdef_arg1[i])))) + && type_has_mode_precision_p (TREE_TYPE (cdef_arg1[i]))) { def_arg2_alt[i] = cdef_arg1[i]; defcodefor_name (def_arg2_alt[i], &cdef_code[i], @@ -1639,8 +1638,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) && INTEGRAL_TYPE_P (TREE_TYPE (tem)) && TYPE_PRECISION (TREE_TYPE (tem)) > floor_log2 (TYPE_PRECISION (rtype)) - && TYPE_PRECISION (TREE_TYPE (tem)) - == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (tem))) + && type_has_mode_precision_p (TREE_TYPE (tem)) && (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i])) { @@ -1667,8 +1665,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) && INTEGRAL_TYPE_P (TREE_TYPE (tem)) && TYPE_PRECISION (TREE_TYPE (tem)) > floor_log2 (TYPE_PRECISION (rtype)) - && TYPE_PRECISION (TREE_TYPE (tem)) - == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (tem)))) + && type_has_mode_precision_p (TREE_TYPE (tem))) defcodefor_name (tem, &code, &tem, NULL); if (code == NEGATE_EXPR) @@ -1683,8 +1680,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) && INTEGRAL_TYPE_P (TREE_TYPE (tem)) && TYPE_PRECISION (TREE_TYPE (tem)) > floor_log2 (TYPE_PRECISION (rtype)) - && TYPE_PRECISION (TREE_TYPE (tem)) - == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (tem))) + && type_has_mode_precision_p (TREE_TYPE (tem)) && (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i])) { -- cgit v1.1