[PATCH][ARM] Do not expand movmisalign pattern if not in 32-bit mode

Kyrill Tkachov kyrylo.tkachov@arm.com
Wed Nov 11 16:11:00 GMT 2015

Hi all,

The attached testcase ICEs when compiled with -march=armv6k -mthumb -Os or any march
for which -mthumb gives Thumb1:
  error: unrecognizable insn:
(insn 13 12 14 5 (set (reg:SI 116 [ x ])
         (unspec:SI [
                 (mem:SI (reg/v/f:SI 112 [ s ]) [0 MEM[(unsigned char *)s_1(D)]+0 S4 A8])
             ] UNSPEC_UNALIGNED_LOAD)) besttry.c:9 -1

The problem is that the expands a movmisalign pattern but the resulting unaligned loads don't
match any define_insn because they are gated on unaligned_access && TARGET_32BIT.
The unaligned_access expander is gated only on unaligned_access.

This small patch fixes the issue by turning off unaligned_access if TARGET_32BIT is not true.
We can then remove TARGET_32BIT from the unaligned load/store patterns conditions as a cleanup.

Bootstrapped and tested on arm-none-linux-gnueabihf.

Ok for trunk?


2015-11-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.c (arm_option_override): Require TARGET_32BIT
     for unaligned_access.
     * config/arm/arm.md (unaligned_loadsi): Remove redundant TARGET_32BIT
     from matching condition.
     (unaligned_loadhis): Likewise.
     (unaligned_loadhiu): Likewise.
     (unaligned_storesi): Likewise.
     (unaligned_storehi): Likewise.

2015-11-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/arm/armv6-unaligned-load-ice.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-armv6-unaligned-ice.patch
Type: text/x-patch
Size: 3696 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151111/bb416487/attachment.bin>

More information about the Gcc-patches mailing list