diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:14:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:14:59 +0000 |
commit | 5602f58c633e51b03b5f18bbd65924b4b842d075 (patch) | |
tree | d8955268a1ac99ffbf94233ae93e5a60a4f5595a /gcc/recog.c | |
parent | ae9270466ed530df375bcaf6b3d834dbef6e3965 (diff) |
[40/77] Use scalar_int_mode for extraction_insn fields
insv, extv and eztzv modify or read a field in a register or
memory. The field always has a scalar integer mode, while the
register or memory either has a scalar integer mode or BLKmode.
The mode of the bit position is also a scalar integer.
This patch uses the type system to make that explicit.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* optabs-query.h (extraction_insn::struct_mode): Change type to
opt_scalar_int_mode and update comment.
(extraction_insn::field_mode): Change type to scalar_int_mode.
(extraction_insn::pos_mode): Likewise.
* combine.c (make_extraction): Update accordingly.
* optabs-query.c (get_traditional_extraction_insn): Likewise.
(get_optab_extraction_insn): Likewise.
* recog.c (simplify_while_replacing): Likewise.
* expmed.c (narrow_bit_field_mem): Change the type of the mode
parameter to opt_scalar_int_mode.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251492
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index 0f9d240931c..4a54e88f5e8 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -663,25 +663,18 @@ simplify_while_replacing (rtx *loc, rtx to, rtx_insn *object, MEM_ADDR_SPACE (XEXP (x, 0))) && !MEM_VOLATILE_P (XEXP (x, 0))) { - machine_mode wanted_mode = VOIDmode; int pos = INTVAL (XEXP (x, 2)); - + machine_mode new_mode = is_mode; if (GET_CODE (x) == ZERO_EXTRACT && targetm.have_extzv ()) - { - wanted_mode = insn_data[targetm.code_for_extzv].operand[1].mode; - if (wanted_mode == VOIDmode) - wanted_mode = word_mode; - } + new_mode = insn_data[targetm.code_for_extzv].operand[1].mode; else if (GET_CODE (x) == SIGN_EXTRACT && targetm.have_extv ()) - { - wanted_mode = insn_data[targetm.code_for_extv].operand[1].mode; - if (wanted_mode == VOIDmode) - wanted_mode = word_mode; - } + new_mode = insn_data[targetm.code_for_extv].operand[1].mode; + scalar_int_mode wanted_mode = (new_mode == VOIDmode + ? word_mode + : as_a <scalar_int_mode> (new_mode)); /* If we have a narrower mode, we can do something. */ - if (wanted_mode != VOIDmode - && GET_MODE_SIZE (wanted_mode) < GET_MODE_SIZE (is_mode)) + if (GET_MODE_SIZE (wanted_mode) < GET_MODE_SIZE (is_mode)) { int offset = pos / BITS_PER_UNIT; rtx newmem; |