https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86968

--- Comment #15 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Right makes sense. So I tried your suggestion (guard the first if with
> !reverse but not the second) and it didn't work. Problem as you suggested is
> adjust_bit_field_mem_for_reg which refuses to do an unaligned load (or
> rather bit_field_mode_iterator's next_mode method refuses). I think
> get_best_mem_extraction_insn does not have this problem because instead it
> just queries whether an instruction to do unaligned access exist.
> 
> Are you aware of a reason why next_mode does not do the same?

The alignment of modes is enforced on strict-alignment targets like ARM:

      /* Stop if the mode requires too much alignment.  */
      if (GET_MODE_ALIGNMENT (mode) > m_align
          && targetm.slow_unaligned_access (mode, m_align))
        break;

So you'll probably need to fiddle with the extv path, i.e. either to implement
the generic handling of reverse storage in extract_bit_field_using_extv or do
it only for simple bitfields in extract_integral_bit_field as discussed
previously.

Reply via email to