> On Jan 26, 2017, at 4:29 PM, Segher Boessenkool <seg...@kernel.crashing.org> > wrote: > > On Thu, Jan 26, 2017 at 03:14:47PM -0600, Bill Schmidt wrote: >> 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? > >> 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. > >> --- 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 } } } } } */ >> > > What does this do if no_align and powerpc and vect_hw_misalign? Or can that > not happen? > That's the usual case. Both vect_no_align and vect_hw_misalign are 1 for POWER8 or later, and 0 otherwise.
If you're asking what happens with !vect_no_align && powerpc*-*-* && vect_hw_misalign, the answer is that it can't happen. I used vect_hw_misalign here because it better documents what's going on. The first clause maintains the existing condition for non-powerpc targets, while the second expects vectorization for POWER8 and later, but not for earlier hardware. Bill > > Segher >