On Mon, Apr 04, 2016 at 02:56:51PM +0200, Richard Biener wrote: > The testcase gcc.target/i386/pr37870.c will already ICE with that > patch, so no additional testcase.
In theory you could validate_subreg first and use that code if validation went ok, otherwise go through memory. But I admit I don't have anything in particular in mind where it would trigger this code and the subreg would successfully validate. > 2016-04-04 Richard Biener <rguent...@suse.de> > > PR middle-end/37870 > * expmed.c (extract_bit_field_1): Remove broken case > using a wider MODE_INT mode. > > Index: gcc/expmed.c > =================================================================== > --- gcc/expmed.c (revision 234708) > +++ gcc/expmed.c (working copy) > @@ -1647,17 +1647,6 @@ extract_bit_field_1 (rtx str_rtx, unsign > if (GET_CODE (op0) == SUBREG) > op0 = force_reg (imode, op0); > } > - else if (REG_P (op0)) > - { > - rtx reg, subreg; > - imode = smallest_mode_for_size (GET_MODE_BITSIZE (GET_MODE (op0)), > - MODE_INT); > - reg = gen_reg_rtx (imode); > - subreg = gen_lowpart_SUBREG (GET_MODE (op0), reg); > - emit_move_insn (subreg, op0); > - op0 = reg; > - bitnum += SUBREG_BYTE (subreg) * BITS_PER_UNIT; > - } > else > { > HOST_WIDE_INT size = GET_MODE_SIZE (GET_MODE (op0)); Jakub