Hi,
Currently test gfortran.dg/vect/fast-math-mgrid-resid.f checks all predictive
commoning opportunities for all possible loops. This makes it fragile because
vectorizer may peel the loop differently, as well as may choose different
vector factors. For example, on x86-solaris, vectorizer doesn't peel for
prologue loop; for -march=haswell, the case is long time failed because vector
factor is 4, while iteration distance of predictive commoning opportunity is
smaller than 4. This patch refines it by only checking if predictive commoning
variable is created when vector factor is 2; or vectorization variable is
created when factor is 4. This works since we have only one main loop, and
only one vector factor can be used.
Test result checked for various x64 targets. Is it OK?
Thanks,
bin
gcc/testsuite/ChangeLog
2016-11-16 Bin Cheng <bin.ch...@arm.com>
PR testsuite/78114
* gfortran.dg/vect/fast-math-mgrid-resid.f: Refine test by
checking predictive commining variables in vectorized loop
wrto vector factor.
diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
b/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
index 88238f9..3e5c4a4 100644
--- a/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
+++ b/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
@@ -1,6 +1,6 @@
! { dg-do compile }
! { dg-require-effective-target vect_double }
-! { dg-options "-O3 -fpredictive-commoning -fdump-tree-pcom-details" }
+! { dg-options "-O3 -fpredictive-commoning -fdump-tree-pcom" }
******* RESID COMPUTES THE RESIDUAL: R = V - AU
@@ -38,8 +38,9 @@ C
RETURN
END
! we want to check that predictive commoning did something on the
-! vectorized loop.
-! { dg-final { scan-tree-dump-times "Executing predictive commoning without
unrolling" 1 "pcom" { target lp64 } } }
-! { dg-final { scan-tree-dump-times "Executing predictive commoning without
unrolling" 2 "pcom" { target ia32 } } }
-! { dg-final { scan-tree-dump-times "Predictive commoning failed: no suitable
chains" 0 "pcom" } }
-! { dg-final { scan-tree-dump-times "Loop iterates only 1 time, nothing to do"
1 "pcom" } }
+! vectorized loop. If vector factor is 2, the vectorized loop can
+! be predictive commoned, we check if predictive commoning variable
+! is created with vector(2) type; if vector factor is 4, there is
+! no predictive commoning opportunity, we check if vector(4) variable
+! is created. This works because only one vector factor can be used.
+! { dg-final { scan-tree-dump-times "vector\\(2\\) real\\(.*\\)
vectp_u.*__lsm|vector\\(4\\) real\\(.*\\)" 1 "pcom" } }