From fb98441af9c84caef6a0e3210ace4b8ffc7e3840 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 13 Oct 2017 09:41:39 +0000 Subject: Make more use of GET_MODE_UNIT_SIZE This patch uses GET_MODE_UNIT_SIZE instead of GET_MODE_SIZE in cases where, for compound modes, the mode of the scalar elements is what matters. E.g. the choice between truncation and extension is really based on the modes of the consistuent scalars rather than the mode as a whole. None of the existing code was wrong. The patch simply makes things easier when converting to variable-sized modes. 2017-10-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * optabs.c (add_equal_note): Use GET_MODE_UNIT_SIZE. (widened_mode): Likewise. (expand_unop): Likewise. * ree.c (transform_ifelse): Likewise. (merge_def_and_ext): Likewise. (combine_reaching_defs): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r253715 --- gcc/ree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gcc/ree.c') diff --git a/gcc/ree.c b/gcc/ree.c index 19225d5..8915cbe 100644 --- a/gcc/ree.c +++ b/gcc/ree.c @@ -428,7 +428,8 @@ transform_ifelse (ext_cand *cand, rtx_insn *def_insn) srcreg2 = XEXP (SET_SRC (set_insn), 2); /* If the conditional move already has the right or wider mode, there is nothing to do. */ - if (GET_MODE_SIZE (GET_MODE (dstreg)) >= GET_MODE_SIZE (cand->mode)) + if (GET_MODE_UNIT_SIZE (GET_MODE (dstreg)) + >= GET_MODE_UNIT_SIZE (cand->mode)) return true; map_srcreg = gen_rtx_REG (cand->mode, REGNO (srcreg)); @@ -718,8 +719,8 @@ merge_def_and_ext (ext_cand *cand, rtx_insn *def_insn, ext_state *state) && state->modified[INSN_UID (def_insn)].mode == ext_src_mode))) { - if (GET_MODE_SIZE (GET_MODE (SET_DEST (*sub_rtx))) - >= GET_MODE_SIZE (cand->mode)) + if (GET_MODE_UNIT_SIZE (GET_MODE (SET_DEST (*sub_rtx))) + >= GET_MODE_UNIT_SIZE (cand->mode)) return true; /* If def_insn is already scheduled to be deleted, don't attempt to modify it. */ @@ -926,7 +927,8 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state) || (set = single_set (cand->insn)) == NULL_RTX) return false; mode = GET_MODE (SET_DEST (set)); - gcc_assert (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (cand->mode)); + gcc_assert (GET_MODE_UNIT_SIZE (mode) + >= GET_MODE_UNIT_SIZE (cand->mode)); cand->mode = mode; } -- cgit v1.1