]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm.c (arm_vector_alignment_reachable): Check unaligned_access.
authorYury Gribov <y.gribov@samsung.com>
Thu, 6 Feb 2014 09:48:15 +0000 (09:48 +0000)
committerYury Gribov <ygribov@gcc.gnu.org>
Thu, 6 Feb 2014 09:48:15 +0000 (09:48 +0000)
2014-02-06  Yury Gribov  <y.gribov@samsung.com>
    Kugan Vivekanandarajah  <kuganv@linaro.org>

gcc/
* config/arm/arm.c (arm_vector_alignment_reachable): Check
unaligned_access.
* config/arm/arm.c (arm_builtin_support_vector_misalignment): Likewise.

testsuite/
* gcc.target/arm/vect-noalign.c: New file.

Co-Authored-By: Kugan Vivekanandarajah <kuganv@linaro.org>
From-SVN: r207533

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/vect-noalign.c [new file with mode: 0644]

index b514a282485192e5c7cd2f35ba114bdcbbeb234f..e83a8242b7015d56f911d1a3ce2052cd1520168b 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-06  Yury Gribov  <y.gribov@samsung.com>
+           Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * config/arm/arm.c (arm_vector_alignment_reachable): Check
+       unaligned_access.
+       * config/arm/arm.c (arm_builtin_support_vector_misalignment): Likewise.
+
 2014-02-06  Richard Biener  <rguenther@suse.de>
 
        * tree-cfg.c (gimple_duplicate_sese_region): Fix ordering of
index 825407feae3295a78ab2e0a741127239e57e0e34..9d05e891a85fe9fbf5f41dc941aae8078acedde0 100644 (file)
@@ -29551,7 +29551,7 @@ arm_vector_alignment_reachable (const_tree type, bool is_packed)
 {
   /* Vectors which aren't in packed structures will not be less aligned than
      the natural alignment of their element type, so this is safe.  */
-  if (TARGET_NEON && !BYTES_BIG_ENDIAN)
+  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
     return !is_packed;
 
   return default_builtin_vector_alignment_reachable (type, is_packed);
@@ -29562,7 +29562,7 @@ arm_builtin_support_vector_misalignment (enum machine_mode mode,
                                         const_tree type, int misalignment,
                                         bool is_packed)
 {
-  if (TARGET_NEON && !BYTES_BIG_ENDIAN)
+  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
     {
       HOST_WIDE_INT align = TYPE_ALIGN_UNIT (type);
 
index efa42473a10d464d6025f94075001f44e5e0936e..70a8f623f64a4cc248994e54cdc0e1f2c20e30af 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-06  Yury Gribov  <y.gribov@samsung.com>
+           Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * gcc.target/arm/vect-noalign.c: New file.
+
 2014-02-05  Jan Hubicka  <hubicka@ucw.cz>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/arm/vect-noalign.c b/gcc/testsuite/gcc.target/arm/vect-noalign.c
new file mode 100644 (file)
index 0000000..a934233
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-options "-mfpu=neon -ffast-math -ftree-vectorize -fno-common -O2 -mno-unaligned-access" } */
+
+
+/* Test for-mno-unaligned-access and -ftree-vectorize  and results bus error. */
+#define N 128
+
+char ia[N];
+char ib[N+1];
+
+int main() {
+  int i;
+  for(i = 0; i < N; ++i) {
+    ia[i] = ib[i + 1];
+  }
+
+  return 0;
+}
+