From 636bfdfaa1b466c5699e8e3c5d46a4f94c9b845c Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 5 Sep 2017 19:56:49 +0000 Subject: [PATCH] Make more use of int_mode_for_mode This patch converts more places that could use int_mode_for_mode instead of mode_for_size. This is in preparation for an upcoming patch that makes mode_for_size itself return an opt_mode. The reason for using required () in exp2_immediate_p is that we go on to do: trunc_int_for_mode (..., int_mode) which would be invalid for (and have failed for) BLKmode. The reason for using required () in spu_convert_move and resolve_simple_move is that we go on to use registers of the returned mode in non-call rtl instructions, which would be invalid for BLKmode. 2017-09-05 Richard Sandiford gcc/ * config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode. (spu_convert_move): Likewise. * lower-subreg.c (resolve_simple_move): Likewise. From-SVN: r251725 --- gcc/ChangeLog | 6 ++++++ gcc/config/spu/spu.c | 6 +++--- gcc/lower-subreg.c | 6 +----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 158b524..58b31d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-05 Richard Sandiford + + * config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode. + (spu_convert_move): Likewise. + * lower-subreg.c (resolve_simple_move): Likewise. + 2017-09-05 Bill Schmidt PR target/81833 diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index d9a0435..e45e302 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -3372,7 +3372,7 @@ arith_immediate_p (rtx op, machine_mode mode, constant_to_array (mode, op, arr); bytes = GET_MODE_UNIT_SIZE (mode); - mode = mode_for_size (GET_MODE_UNIT_BITSIZE (mode), MODE_INT, 0); + mode = int_mode_for_mode (GET_MODE_INNER (mode)).require (); /* Check that bytes are repeated. */ for (i = bytes; i < 16; i += bytes) @@ -3415,7 +3415,7 @@ exp2_immediate_p (rtx op, machine_mode mode, int low, int high) mode = GET_MODE_INNER (mode); bytes = GET_MODE_SIZE (mode); - int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0); + int_mode = int_mode_for_mode (mode).require (); /* Check that bytes are repeated. */ for (i = bytes; i < 16; i += bytes) @@ -4503,7 +4503,7 @@ static void spu_convert_move (rtx dst, rtx src) { machine_mode mode = GET_MODE (dst); - machine_mode int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0); + machine_mode int_mode = int_mode_for_mode (mode).require (); rtx reg; gcc_assert (GET_MODE (src) == TImode); reg = int_mode != mode ? gen_reg_rtx (int_mode) : dst; diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index e93dbd6..43b6cd0 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -956,11 +956,7 @@ resolve_simple_move (rtx set, rtx_insn *insn) if (real_dest == NULL_RTX) real_dest = dest; if (!SCALAR_INT_MODE_P (dest_mode)) - { - dest_mode = mode_for_size (GET_MODE_SIZE (dest_mode) * BITS_PER_UNIT, - MODE_INT, 0); - gcc_assert (dest_mode != BLKmode); - } + dest_mode = int_mode_for_mode (dest_mode).require (); dest = gen_reg_rtx (dest_mode); if (REG_P (real_dest)) REG_ATTRS (dest) = REG_ATTRS (real_dest); -- 2.7.4