From: Yury Gribov Date: Thu, 6 Feb 2014 09:48:15 +0000 (+0000) Subject: arm.c (arm_vector_alignment_reachable): Check unaligned_access. X-Git-Tag: releases/gcc-4.9.0~1065 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c801e24619405cf2ca3eb3faea28c45f10ce00d7;p=thirdparty%2Fgcc.git arm.c (arm_vector_alignment_reachable): Check unaligned_access. 2014-02-06 Yury Gribov Kugan Vivekanandarajah 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 From-SVN: r207533 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b514a2824851..e83a8242b701 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-02-06 Yury Gribov + Kugan Vivekanandarajah + + * 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 * tree-cfg.c (gimple_duplicate_sese_region): Fix ordering of diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 825407feae32..9d05e891a85f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efa42473a10d..70a8f623f64a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-02-06 Yury Gribov + Kugan Vivekanandarajah + + * gcc.target/arm/vect-noalign.c: New file. + 2014-02-05 Jan Hubicka Jakub Jelinek diff --git a/gcc/testsuite/gcc.target/arm/vect-noalign.c b/gcc/testsuite/gcc.target/arm/vect-noalign.c new file mode 100644 index 000000000000..a934233a33df --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vect-noalign.c @@ -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; +} +