Hi,

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65484 identifies an
issue whether g++.dg/vect/pr36648.cc fails on older POWER hardware.
This is due to a decision made in November 2010 to include the
flag -mno-allow-movmisalign in check_vect_support_and_set_flags,
which governs the vectorizer tests in that directory.  This flag
sometimes inhibits vectorization when to vectorize the code
requires that misaligned loads and stores be used.  This flag is
not added to the command line for POWER8 hardware and later.

pr36648.cc is an example of the kind of vectorization that
requires misaligned memory accesses, so it is vectorized on 
POWER8 and later hardware, but not on POWER7 or earlier with
the default testsuite flags.  This patch modifies the dg-final
checks in pr36648.cc to be consistent with this behavior.  I've
added commentary to explain what might otherwise seem to be a
somewhat arcane choice of tests.

Tested on trunk and GCC 6 for POWER8 LE and POWER7 BE systems.
Is this ok for trunk?

Thanks,
Bill


2017-01-26  Bill Schmidt  <wschm...@linux.vnet.ibm.com>

        PR target/65484
        * g++.dg/vect/pr36648.cc: Modify to reflect that the loop is not
        vectorized on POWER unless hardware misaligned loads are
        available.


Index: gcc/testsuite/g++.dg/vect/pr36648.cc
===================================================================
--- gcc/testsuite/g++.dg/vect/pr36648.cc        (revision 244811)
+++ gcc/testsuite/g++.dg/vect/pr36648.cc        (working copy)
@@ -19,7 +19,12 @@ Foo foo;
 
 int main() { }
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { 
!  vect_no_align } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { 
target { ! vect_no_align } } } } */
+/* On older powerpc hardware (POWER7 and earlier), the default flag
+   -mno-allow-movmisalign prevents vectorization.  On POWER8 and later,
+   when vect_hw_misalign is true, vectorization occurs.  For other
+   targets, ! vect_no_align is a sufficient test.  */
 
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { 
{ { !  vect_no_align } && { ! powerpc*-*-* } } || { powerpc*-*-* && 
vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { 
target { { { ! vect_no_align } && { ! powerpc*-*-* } } || { powerpc*-*-* && 
vect_hw_misalign } } } } } */
 
+

Reply via email to