[ARM] Do not expand movmisalign pattern if not in 32-bit mode
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Fri, 20 Nov 2015 15:19:09 +0000 (15:19 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Fri, 20 Nov 2015 15:19:09 +0000 (15:19 +0000)
* 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.

* gcc.target/arm/armv6-unaligned-load-ice.c: New test.

From-SVN: r230664

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/armv6-unaligned-load-ice.c [new file with mode: 0644]

index 235a3b0cdc98d6b720b6017e10d5922d3d2c3d69..a16d09c0a4e2381def08aaad035550ae3022e1a2 100644 (file)
@@ -1,3 +1,14 @@
+2015-11-20  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-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/68149
index 805335ce354da661a3a7afdee124724cc3cdf8e4..290b537ae166b5d48fdf28e461c9dafb8be3ef9d 100644 (file)
@@ -3282,7 +3282,8 @@ arm_option_override (void)
     }
 
   /* Enable -munaligned-access by default for
-     - all ARMv6 architecture-based processors
+     - all ARMv6 architecture-based processors when compiling for a 32-bit ISA
+     i.e. Thumb2 and ARM state only.
      - ARMv7-A, ARMv7-R, and ARMv7-M architecture-based processors.
      - ARMv8 architecture-base processors.
 
@@ -3292,7 +3293,7 @@ arm_option_override (void)
 
   if (unaligned_access == 2)
     {
-      if (arm_arch6 && (arm_arch_notm || arm_arch7))
+      if (TARGET_32BIT && arm_arch6 && (arm_arch_notm || arm_arch7))
        unaligned_access = 1;
       else
        unaligned_access = 0;
index 227a9bd3f3d8ff5ff4900b026d11690fe3561f8f..effe7eb799d6e5e6da950be03043d8d397d52db2 100644 (file)
   [(set (match_operand:SI 0 "s_register_operand" "=l,r")
        (unspec:SI [(match_operand:SI 1 "memory_operand" "Uw,m")]
                   UNSPEC_UNALIGNED_LOAD))]
-  "unaligned_access && TARGET_32BIT"
+  "unaligned_access"
   "ldr%?\t%0, %1\t@ unaligned"
   [(set_attr "arch" "t2,any")
    (set_attr "length" "2,4")
        (sign_extend:SI
          (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,Uh")]
                     UNSPEC_UNALIGNED_LOAD)))]
-  "unaligned_access && TARGET_32BIT"
+  "unaligned_access"
   "ldrsh%?\t%0, %1\t@ unaligned"
   [(set_attr "arch" "t2,any")
    (set_attr "length" "2,4")
        (zero_extend:SI
          (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,m")]
                     UNSPEC_UNALIGNED_LOAD)))]
-  "unaligned_access && TARGET_32BIT"
+  "unaligned_access"
   "ldrh%?\t%0, %1\t@ unaligned"
   [(set_attr "arch" "t2,any")
    (set_attr "length" "2,4")
   [(set (match_operand:SI 0 "memory_operand" "=Uw,m")
        (unspec:SI [(match_operand:SI 1 "s_register_operand" "l,r")]
                   UNSPEC_UNALIGNED_STORE))]
-  "unaligned_access && TARGET_32BIT"
+  "unaligned_access"
   "str%?\t%1, %0\t@ unaligned"
   [(set_attr "arch" "t2,any")
    (set_attr "length" "2,4")
   [(set (match_operand:HI 0 "memory_operand" "=Uw,m")
        (unspec:HI [(match_operand:HI 1 "s_register_operand" "l,r")]
                   UNSPEC_UNALIGNED_STORE))]
-  "unaligned_access && TARGET_32BIT"
+  "unaligned_access"
   "strh%?\t%1, %0\t@ unaligned"
   [(set_attr "arch" "t2,any")
    (set_attr "length" "2,4")
index b6810c8fd786dd81d09db5fdcce00d5db8718962..d55f6dd231b87dc7502c1375be89d86dc5277ec5 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * gcc.target/arm/armv6-unaligned-load-ice.c: New test.
+
 2015-11-20  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/68237
diff --git a/gcc/testsuite/gcc.target/arm/armv6-unaligned-load-ice.c b/gcc/testsuite/gcc.target/arm/armv6-unaligned-load-ice.c
new file mode 100644 (file)
index 0000000..88528f1
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv6k" } } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */
+/* { dg-options "-mthumb -Os -mfloat-abi=softfp" } */
+/* { dg-add-options arm_arch_v6k } */
+
+long
+get_number (char *s, long size, int unsigned_p)
+{
+  long x;
+  unsigned char *p = (unsigned char *) s;
+  switch (size)
+    {
+    case 4:
+      x = ((long) p[3] << 24) | ((long) p[2] << 16) | (p[1] << 8) | p[0];
+      return x;
+    }
+}