From b4206259f10455603e0c90825566de1ea777c04a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:10:53 +0000 Subject: [20/77] Replace MODE_INT checks with is_int_mode Replace checks of "GET_MODE_CLASS (...) == MODE_INT" with "is_int_mode (..., &var)", in cases where it becomes useful to refer to the mode as a scalar_int_mode. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * machmode.h (is_int_mode): New fuction. * combine.c (find_split_point): Use it. (combine_simplify_rtx): Likewise. (simplify_if_then_else): Likewise. (simplify_set): Likewise. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64.c (aarch64_rtx_costs): Likewise. * cse.c (notreg_cost): Likewise. (cse_insn): Likewise. * cselib.c (cselib_lookup_1): Likewise. * dojump.c (do_jump_1): Likewise. (do_compare_rtx_and_jump): Likewise. * dse.c (get_call_args): Likewise. * dwarf2out.c (rtl_for_decl_init): Likewise. (native_encode_initializer): Likewise. * expmed.c (emit_store_flag_1): Likewise. (emit_store_flag): Likewise. * expr.c (convert_modes): Likewise. (store_field): Likewise. (expand_expr_real_1): Likewise. * fold-const.c (fold_read_from_constant_string): Likewise. * gimple-ssa-sprintf.c (get_format_string): Likewise. * optabs-libfuncs.c (gen_int_libfunc): Likewise. * optabs.c (expand_binop): Likewise. (expand_unop): Likewise. (expand_abs_nojump): Likewise. (expand_one_cmpl_abs_nojump): Likewise. * simplify-rtx.c (mode_signbit_p): Likewise. (val_signbit_p): Likewise. (val_signbit_known_set_p): Likewise. (val_signbit_known_clear_p): Likewise. (simplify_relational_operation_1): Likewise. * tree.c (vector_type_mode): Likewise. gcc/go/ * go-lang.c (go_langhook_type_for_mode): Use is_int_mode. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251472 --- gcc/cselib.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/cselib.c') diff --git a/gcc/cselib.c b/gcc/cselib.c index 74c25ac..41e0e4f 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -2009,6 +2009,8 @@ cselib_lookup_1 (rtx x, machine_mode mode, e = new_cselib_val (next_uid, GET_MODE (x), x); new_elt_loc_list (e, x); + + scalar_int_mode int_mode; if (REG_VALUES (i) == 0) { /* Maintain the invariant that the first entry of @@ -2018,27 +2020,27 @@ cselib_lookup_1 (rtx x, machine_mode mode, REG_VALUES (i) = new_elt_list (REG_VALUES (i), NULL); } else if (cselib_preserve_constants - && GET_MODE_CLASS (mode) == MODE_INT) + && is_int_mode (mode, &int_mode)) { /* During var-tracking, try harder to find equivalences for SUBREGs. If a setter sets say a DImode register and user uses that register only in SImode, add a lowpart subreg location. */ struct elt_list *lwider = NULL; + scalar_int_mode lmode; l = REG_VALUES (i); if (l && l->elt == NULL) l = l->next; for (; l; l = l->next) - if (GET_MODE_CLASS (GET_MODE (l->elt->val_rtx)) == MODE_INT - && GET_MODE_SIZE (GET_MODE (l->elt->val_rtx)) - > GET_MODE_SIZE (mode) + if (is_int_mode (GET_MODE (l->elt->val_rtx), &lmode) + && GET_MODE_SIZE (lmode) > GET_MODE_SIZE (int_mode) && (lwider == NULL - || GET_MODE_SIZE (GET_MODE (l->elt->val_rtx)) + || GET_MODE_SIZE (lmode) < GET_MODE_SIZE (GET_MODE (lwider->elt->val_rtx)))) { struct elt_loc_list *el; if (i < FIRST_PSEUDO_REGISTER - && hard_regno_nregs[i][GET_MODE (l->elt->val_rtx)] != 1) + && hard_regno_nregs[i][lmode] != 1) continue; for (el = l->elt->locs; el; el = el->next) if (!REG_P (el->loc)) @@ -2048,7 +2050,7 @@ cselib_lookup_1 (rtx x, machine_mode mode, } if (lwider) { - rtx sub = lowpart_subreg (mode, lwider->elt->val_rtx, + rtx sub = lowpart_subreg (int_mode, lwider->elt->val_rtx, GET_MODE (lwider->elt->val_rtx)); if (sub) new_elt_loc_list (e, sub); -- cgit v1.1