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/optabs-query.c | |
parent | ae9270466ed530df375bcaf6b3d834dbef6e3965 (diff) | |
download | gcc-5602f58c633e51b03b5f18bbd65924b4b842d075.zip gcc-5602f58c633e51b03b5f18bbd65924b4b842d075.tar.gz gcc-5602f58c633e51b03b5f18bbd65924b4b842d075.tar.bz2 |
[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/optabs-query.c')
-rw-r--r-- | gcc/optabs-query.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/optabs-query.c b/gcc/optabs-query.c index 48b1250..b4a4976 100644 --- a/gcc/optabs-query.c +++ b/gcc/optabs-query.c @@ -100,9 +100,14 @@ get_traditional_extraction_insn (extraction_insn *insn, pos_mode = word_mode; insn->icode = icode; - insn->field_mode = field_mode; - insn->struct_mode = (type == ET_unaligned_mem ? byte_mode : struct_mode); - insn->pos_mode = pos_mode; + insn->field_mode = as_a <scalar_int_mode> (field_mode); + if (type == ET_unaligned_mem) + insn->struct_mode = byte_mode; + else if (struct_mode == BLKmode) + insn->struct_mode = opt_scalar_int_mode (); + else + insn->struct_mode = as_a <scalar_int_mode> (struct_mode); + insn->pos_mode = as_a <scalar_int_mode> (pos_mode); return true; } @@ -126,12 +131,17 @@ get_optab_extraction_insn (struct extraction_insn *insn, const struct insn_data_d *data = &insn_data[icode]; + machine_mode pos_mode = data->operand[pos_op].mode; + if (pos_mode == VOIDmode) + pos_mode = word_mode; + insn->icode = icode; - insn->field_mode = mode; - insn->struct_mode = (type == ET_unaligned_mem ? BLKmode : mode); - insn->pos_mode = data->operand[pos_op].mode; - if (insn->pos_mode == VOIDmode) - insn->pos_mode = word_mode; + insn->field_mode = as_a <scalar_int_mode> (mode); + if (type == ET_unaligned_mem) + insn->struct_mode = opt_scalar_int_mode (); + else + insn->struct_mode = insn->field_mode; + insn->pos_mode = as_a <scalar_int_mode> (pos_mode); return true; } |