* [PATCH] Adjust more testcases for O2 vectorization enabling.
@ 2021-10-09 4:55 liuhongt
2021-10-09 21:36 ` H.J. Lu
2021-10-11 9:28 ` [PATCH] Adjust more testcases " Jakub Jelinek
0 siblings, 2 replies; 9+ messages in thread
From: liuhongt @ 2021-10-09 4:55 UTC (permalink / raw)
To: gcc-patches
Pushed to trunk.
libgomp/ChangeLog:
* testsuite/libgomp.c++/scan-10.C: Add option -fvect-cost-model=cheap.
* testsuite/libgomp.c++/scan-11.C: Ditto.
* testsuite/libgomp.c++/scan-12.C: Ditto.
* testsuite/libgomp.c++/scan-13.C: Ditto.
* testsuite/libgomp.c++/scan-14.C: Ditto.
* testsuite/libgomp.c++/scan-15.C: Ditto.
* testsuite/libgomp.c++/scan-16.C: Ditto.
* testsuite/libgomp.c++/scan-9.C: Ditto.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: Ditto.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: Ditto.
* testsuite/libgomp.c/scan-11.c: Ditto.
* testsuite/libgomp.c/scan-12.c: Ditto.
* testsuite/libgomp.c/scan-13.c: Ditto.
* testsuite/libgomp.c/scan-14.c: Ditto.
* testsuite/libgomp.c/scan-15.c: Ditto.
* testsuite/libgomp.c/scan-16.c: Ditto.
* testsuite/libgomp.c/scan-17.c: Ditto.
* testsuite/libgomp.c/scan-18.c: Ditto.
* testsuite/libgomp.c/scan-19.c: Ditto.
* testsuite/libgomp.c/scan-20.c: Ditto.
* testsuite/libgomp.c/scan-21.c: Ditto.
* testsuite/libgomp.c/scan-22.c: Ditto.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr94403.C: Add -fno-tree-vectorize
* gcc.dg/optimize-bswapsi-5.c: Ditto.
* gcc.dg/optimize-bswapsi-6.c: Ditto.
* gcc.dg/Warray-bounds-51.c: Add -mtune=generic
* gcc.dg/Wstringop-overflow-14.c:
---
gcc/testsuite/g++.dg/tree-ssa/pr94403.C | 2 +-
gcc/testsuite/gcc.dg/Warray-bounds-51.c | 3 ++-
gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 3 ++-
gcc/testsuite/gcc.dg/optimize-bswapsi-5.c | 2 +-
gcc/testsuite/gcc.dg/optimize-bswapsi-6.c | 2 +-
libgomp/testsuite/libgomp.c++/scan-10.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-11.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-12.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-13.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-14.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-15.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-16.C | 2 +-
libgomp/testsuite/libgomp.c++/scan-9.C | 2 +-
.../testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c | 2 +-
.../testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c | 2 +-
libgomp/testsuite/libgomp.c/scan-11.c | 2 +-
libgomp/testsuite/libgomp.c/scan-12.c | 2 +-
libgomp/testsuite/libgomp.c/scan-13.c | 2 +-
libgomp/testsuite/libgomp.c/scan-14.c | 2 +-
libgomp/testsuite/libgomp.c/scan-15.c | 2 +-
libgomp/testsuite/libgomp.c/scan-16.c | 2 +-
libgomp/testsuite/libgomp.c/scan-17.c | 2 +-
libgomp/testsuite/libgomp.c/scan-18.c | 2 +-
libgomp/testsuite/libgomp.c/scan-19.c | 2 +-
libgomp/testsuite/libgomp.c/scan-20.c | 2 +-
libgomp/testsuite/libgomp.c/scan-21.c | 2 +-
libgomp/testsuite/libgomp.c/scan-22.c | 2 +-
27 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr94403.C b/gcc/testsuite/g++.dg/tree-ssa/pr94403.C
index d47e7fcc5a3..5f8f868e469 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr94403.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr94403.C
@@ -3,7 +3,7 @@
// are either big or little endian (not pdp endian).
// { dg-do compile { target { lp64 && { i?86-*-* x86_64-*-* powerpc*-*-* aarch64*-*-* } } } }
// { dg-require-effective-target store_merge }
-// { dg-options "-O2 -fdump-tree-store-merging -std=c++17" }
+// { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging -std=c++17" }
namespace std {
template <typename T>
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-51.c b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
index b0b8bdb7938..cadb7a3f1b2 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-51.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
@@ -1,7 +1,8 @@
/* PR middle-end/92333 - missing variable name referencing VLA in warnings
PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index
{ dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall" }
+ { dg-additional-options "-mtune=generic" { target { i?86-*-* x86_64-*-* } } } */
void sink (void*);
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
index b648f5b41b1..83b069c3de8 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
@@ -2,7 +2,8 @@
types than char are diagnosed.
{ dg-do compile }
{ dg-require-effective-target int32plus }
- { dg-options "-O2 -Wall -Wno-array-bounds" } */
+ { dg-options "-O2 -Wall -Wno-array-bounds" }
+ { dg-additional-options "-mtune=generic" { target { i?86-*-* x86_64-*-* } } } */
typedef __INT16_TYPE__ int16_t;
typedef __INT32_TYPE__ int32_t;
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
index 91a5284fa81..5934aacf75a 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
-/* { dg-options "-O2 -fdump-tree-optimized -fno-inline-functions" } */
+/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-optimized -fno-inline-functions" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
struct L { unsigned int l[2]; };
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
index 3c089b36fd8..75f8aecb5d8 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
@@ -1,7 +1,7 @@
/* PR tree-optimization/42587 */
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
-/* { dg-options "-O2 -fdump-tree-store-merging" } */
+/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
typedef unsigned char u8;
diff --git a/libgomp/testsuite/libgomp.c++/scan-10.C b/libgomp/testsuite/libgomp.c++/scan-10.C
index 04b8796a24e..df5e724dcae 100644
--- a/libgomp/testsuite/libgomp.c++/scan-10.C
+++ b/libgomp/testsuite/libgomp.c++/scan-10.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-11.C b/libgomp/testsuite/libgomp.c++/scan-11.C
index 9e83effd077..f895486f800 100644
--- a/libgomp/testsuite/libgomp.c++/scan-11.C
+++ b/libgomp/testsuite/libgomp.c++/scan-11.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-12.C b/libgomp/testsuite/libgomp.c++/scan-12.C
index ee911578520..39959dc290a 100644
--- a/libgomp/testsuite/libgomp.c++/scan-12.C
+++ b/libgomp/testsuite/libgomp.c++/scan-12.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-13.C b/libgomp/testsuite/libgomp.c++/scan-13.C
index 613045768e7..44db445ff6c 100644
--- a/libgomp/testsuite/libgomp.c++/scan-13.C
+++ b/libgomp/testsuite/libgomp.c++/scan-13.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-14.C b/libgomp/testsuite/libgomp.c++/scan-14.C
index 8ee4354c7fc..e20dd05effd 100644
--- a/libgomp/testsuite/libgomp.c++/scan-14.C
+++ b/libgomp/testsuite/libgomp.c++/scan-14.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-15.C b/libgomp/testsuite/libgomp.c++/scan-15.C
index 69550af9d62..e36bc07b337 100644
--- a/libgomp/testsuite/libgomp.c++/scan-15.C
+++ b/libgomp/testsuite/libgomp.c++/scan-15.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-16.C b/libgomp/testsuite/libgomp.c++/scan-16.C
index 3fb6135c343..07e0a4a29d0 100644
--- a/libgomp/testsuite/libgomp.c++/scan-16.C
+++ b/libgomp/testsuite/libgomp.c++/scan-16.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c++/scan-9.C b/libgomp/testsuite/libgomp.c++/scan-9.C
index cd08f76895b..91fa14b3f43 100644
--- a/libgomp/testsuite/libgomp.c++/scan-9.C
+++ b/libgomp/testsuite/libgomp.c++/scan-9.C
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
diff --git a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c
index 2d542d6d56c..3b5875550a0 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-additional-options "-O2 -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target avx_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c
index b935a6c2dbf..0443c9d1ab9 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-additional-options "-O2 -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target avx_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-11.c b/libgomp/testsuite/libgomp.c/scan-11.c
index 3bc2d3a1d7c..bc9f9410e66 100644
--- a/libgomp/testsuite/libgomp.c/scan-11.c
+++ b/libgomp/testsuite/libgomp.c/scan-11.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-12.c b/libgomp/testsuite/libgomp.c/scan-12.c
index f769d17e8ca..a290dd66688 100644
--- a/libgomp/testsuite/libgomp.c/scan-12.c
+++ b/libgomp/testsuite/libgomp.c/scan-12.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-13.c b/libgomp/testsuite/libgomp.c/scan-13.c
index 9cf1623d262..0822ad9bc2b 100644
--- a/libgomp/testsuite/libgomp.c/scan-13.c
+++ b/libgomp/testsuite/libgomp.c/scan-13.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-14.c b/libgomp/testsuite/libgomp.c/scan-14.c
index 3a20a75b2e9..206ac78d05b 100644
--- a/libgomp/testsuite/libgomp.c/scan-14.c
+++ b/libgomp/testsuite/libgomp.c/scan-14.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-15.c b/libgomp/testsuite/libgomp.c/scan-15.c
index c0c6dfd3b99..dd9abe9702c 100644
--- a/libgomp/testsuite/libgomp.c/scan-15.c
+++ b/libgomp/testsuite/libgomp.c/scan-15.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-16.c b/libgomp/testsuite/libgomp.c/scan-16.c
index 8b816781dd8..f85269f9d08 100644
--- a/libgomp/testsuite/libgomp.c/scan-16.c
+++ b/libgomp/testsuite/libgomp.c/scan-16.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-17.c b/libgomp/testsuite/libgomp.c/scan-17.c
index 57e4390462a..fb03c8ce040 100644
--- a/libgomp/testsuite/libgomp.c/scan-17.c
+++ b/libgomp/testsuite/libgomp.c/scan-17.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-18.c b/libgomp/testsuite/libgomp.c/scan-18.c
index ae467fc7bdb..81679b4d72b 100644
--- a/libgomp/testsuite/libgomp.c/scan-18.c
+++ b/libgomp/testsuite/libgomp.c/scan-18.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-19.c b/libgomp/testsuite/libgomp.c/scan-19.c
index b4205012902..098fb437188 100644
--- a/libgomp/testsuite/libgomp.c/scan-19.c
+++ b/libgomp/testsuite/libgomp.c/scan-19.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-20.c b/libgomp/testsuite/libgomp.c/scan-20.c
index 3ef88d78d9d..ae834f96a15 100644
--- a/libgomp/testsuite/libgomp.c/scan-20.c
+++ b/libgomp/testsuite/libgomp.c/scan-20.c
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
diff --git a/libgomp/testsuite/libgomp.c/scan-21.c b/libgomp/testsuite/libgomp.c/scan-21.c
index c531961ffe4..cd7fe2572f6 100644
--- a/libgomp/testsuite/libgomp.c/scan-21.c
+++ b/libgomp/testsuite/libgomp.c/scan-21.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target avx_runtime } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
#include "scan-13.c"
diff --git a/libgomp/testsuite/libgomp.c/scan-22.c b/libgomp/testsuite/libgomp.c/scan-22.c
index 96fead7d54d..e548f97c3a1 100644
--- a/libgomp/testsuite/libgomp.c/scan-22.c
+++ b/libgomp/testsuite/libgomp.c/scan-22.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target avx_runtime } */
-/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
+/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
#include "scan-17.c"
--
2.18.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Adjust more testcases for O2 vectorization enabling.
2021-10-09 4:55 [PATCH] Adjust more testcases for O2 vectorization enabling liuhongt
@ 2021-10-09 21:36 ` H.J. Lu
2021-10-11 2:10 ` [PATCH] Adjust testcase " liuhongt
2021-10-11 9:28 ` [PATCH] Adjust more testcases " Jakub Jelinek
1 sibling, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2021-10-09 21:36 UTC (permalink / raw)
To: liuhongt; +Cc: GCC Patches, Hongtao Liu
On Fri, Oct 8, 2021 at 9:55 PM liuhongt <hongtao.liu@intel.com> wrote:
>
> Pushed to trunk.
>
> libgomp/ChangeLog:
>
> * testsuite/libgomp.c++/scan-10.C: Add option -fvect-cost-model=cheap.
> * testsuite/libgomp.c++/scan-11.C: Ditto.
> * testsuite/libgomp.c++/scan-12.C: Ditto.
> * testsuite/libgomp.c++/scan-13.C: Ditto.
> * testsuite/libgomp.c++/scan-14.C: Ditto.
> * testsuite/libgomp.c++/scan-15.C: Ditto.
> * testsuite/libgomp.c++/scan-16.C: Ditto.
> * testsuite/libgomp.c++/scan-9.C: Ditto.
> * testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: Ditto.
> * testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: Ditto.
> * testsuite/libgomp.c/scan-11.c: Ditto.
> * testsuite/libgomp.c/scan-12.c: Ditto.
> * testsuite/libgomp.c/scan-13.c: Ditto.
> * testsuite/libgomp.c/scan-14.c: Ditto.
> * testsuite/libgomp.c/scan-15.c: Ditto.
> * testsuite/libgomp.c/scan-16.c: Ditto.
> * testsuite/libgomp.c/scan-17.c: Ditto.
> * testsuite/libgomp.c/scan-18.c: Ditto.
> * testsuite/libgomp.c/scan-19.c: Ditto.
> * testsuite/libgomp.c/scan-20.c: Ditto.
> * testsuite/libgomp.c/scan-21.c: Ditto.
> * testsuite/libgomp.c/scan-22.c: Ditto.
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/tree-ssa/pr94403.C: Add -fno-tree-vectorize
> * gcc.dg/optimize-bswapsi-5.c: Ditto.
> * gcc.dg/optimize-bswapsi-6.c: Ditto.
> * gcc.dg/Warray-bounds-51.c: Add -mtune=generic
> * gcc.dg/Wstringop-overflow-14.c:
libgomp.graphite/force-parallel-8.c also fails because of the -O2 change.
--
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] Adjust testcase for O2 vectorization enabling
2021-10-09 21:36 ` H.J. Lu
@ 2021-10-11 2:10 ` liuhongt
2021-10-11 2:22 ` Kewen.Lin
0 siblings, 1 reply; 9+ messages in thread
From: liuhongt @ 2021-10-11 2:10 UTC (permalink / raw)
To: gcc-patches
libgomp/ChangeLog:
* testsuite/libgomp.graphite/force-parallel-8.c: Add -fno-tree-vectorize.
---
libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
index f9e07039172..0f3d138cebd 100644
--- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1" } */
+/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1 -fno-tree-vectorize" } */
#define N 1500
--
2.18.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Adjust testcase for O2 vectorization enabling
2021-10-11 2:10 ` [PATCH] Adjust testcase " liuhongt
@ 2021-10-11 2:22 ` Kewen.Lin
2021-10-11 2:39 ` Hongtao Liu
0 siblings, 1 reply; 9+ messages in thread
From: Kewen.Lin @ 2021-10-11 2:22 UTC (permalink / raw)
To: Hongtao Liu; +Cc: gcc-patches, H.J. Lu, Richard Biener
Hi Hongtao,
on 2021/10/11 上午10:10, liuhongt via Gcc-patches wrote:
> libgomp/ChangeLog:
>
> * testsuite/libgomp.graphite/force-parallel-8.c: Add -fno-tree-vectorize.
> ---
> libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> index f9e07039172..0f3d138cebd 100644
> --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> @@ -1,4 +1,4 @@
> -/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1" } */
> +/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1 -fno-tree-vectorize" } */
>
> #define N 1500
>
>
Thanks for doing this!
This issue was observed in rs6000 specific PR102658 as well.
I've looked into it a bit, it's caused by the "conditional store replacement" which
is originally disabled without vectorization as below code.
/* If either vectorization or if-conversion is disabled then do
not sink any stores. */
if (param_max_stores_to_sink == 0
|| (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize)
|| !flag_tree_loop_if_convert)
return false;
The new change makes the innermost loop look like
for (int c1 = 0; c1 <= 1499; c1 += 1) {
if (c1 <= 500) {
S_10(c0, c1);
} else {
S_9(c0, c1);
}
S_11(c0, c1);
}
and can not be splitted as:
for (int c1 = 0; c1 <= 500; c1 += 1)
S_10(c0, c1);
for (int c1 = 501; c1 <= 1499; c1 += 1)
S_9(c0, c1);
So instead of disabling vectorization, could we just disable this cs replacement
with parameter "--param max-stores-to-sink=0"?
I tested this proposal on ppc64le, it should work as well.
What do you think of it?
BR,
Kewen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Adjust testcase for O2 vectorization enabling
2021-10-11 2:22 ` Kewen.Lin
@ 2021-10-11 2:39 ` Hongtao Liu
0 siblings, 0 replies; 9+ messages in thread
From: Hongtao Liu @ 2021-10-11 2:39 UTC (permalink / raw)
To: Kewen.Lin; +Cc: Hongtao Liu, GCC Patches
On Mon, Oct 11, 2021 at 10:23 AM Kewen.Lin via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi Hongtao,
>
> on 2021/10/11 上午10:10, liuhongt via Gcc-patches wrote:
> > libgomp/ChangeLog:
> >
> > * testsuite/libgomp.graphite/force-parallel-8.c: Add -fno-tree-vectorize.
> > ---
> > libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > index f9e07039172..0f3d138cebd 100644
> > --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > @@ -1,4 +1,4 @@
> > -/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1" } */
> > +/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1 -fno-tree-vectorize" } */
> >
> > #define N 1500
> >
> >
>
> Thanks for doing this!
>
> This issue was observed in rs6000 specific PR102658 as well.
>
> I've looked into it a bit, it's caused by the "conditional store replacement" which
> is originally disabled without vectorization as below code.
>
> /* If either vectorization or if-conversion is disabled then do
> not sink any stores. */
> if (param_max_stores_to_sink == 0
> || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize)
> || !flag_tree_loop_if_convert)
> return false;
>
> The new change makes the innermost loop look like
>
> for (int c1 = 0; c1 <= 1499; c1 += 1) {
> if (c1 <= 500) {
> S_10(c0, c1);
> } else {
> S_9(c0, c1);
> }
> S_11(c0, c1);
> }
>
> and can not be splitted as:
>
> for (int c1 = 0; c1 <= 500; c1 += 1)
> S_10(c0, c1);
>
> for (int c1 = 501; c1 <= 1499; c1 += 1)
> S_9(c0, c1);
>
> So instead of disabling vectorization, could we just disable this cs replacement
> with parameter "--param max-stores-to-sink=0"?
>
> I tested this proposal on ppc64le, it should work as well.
>
> What do you think of it?
I can confirm it also works for x86, I'll adjust the patch.
Thank you for the analysis.
>
> BR,
> Kewen
--
BR,
Hongtao
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Adjust more testcases for O2 vectorization enabling.
2021-10-09 4:55 [PATCH] Adjust more testcases for O2 vectorization enabling liuhongt
2021-10-09 21:36 ` H.J. Lu
@ 2021-10-11 9:28 ` Jakub Jelinek
2021-10-11 12:15 ` [PATCH] vectorizer: Fix up -fsimd-cost-model= handling Jakub Jelinek
1 sibling, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2021-10-11 9:28 UTC (permalink / raw)
To: liuhongt, Richard Biener; +Cc: gcc-patches
On Sat, Oct 09, 2021 at 12:55:15PM +0800, liuhongt via Gcc-patches wrote:
> Pushed to trunk.
>
> libgomp/ChangeLog:
>
> * testsuite/libgomp.c++/scan-10.C: Add option -fvect-cost-model=cheap.
> * testsuite/libgomp.c++/scan-11.C: Ditto.
> * testsuite/libgomp.c++/scan-12.C: Ditto.
> * testsuite/libgomp.c++/scan-13.C: Ditto.
> * testsuite/libgomp.c++/scan-14.C: Ditto.
> * testsuite/libgomp.c++/scan-15.C: Ditto.
> * testsuite/libgomp.c++/scan-16.C: Ditto.
> * testsuite/libgomp.c++/scan-9.C: Ditto.
> * testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: Ditto.
> * testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: Ditto.
> * testsuite/libgomp.c/scan-11.c: Ditto.
> * testsuite/libgomp.c/scan-12.c: Ditto.
> * testsuite/libgomp.c/scan-13.c: Ditto.
> * testsuite/libgomp.c/scan-14.c: Ditto.
> * testsuite/libgomp.c/scan-15.c: Ditto.
> * testsuite/libgomp.c/scan-16.c: Ditto.
> * testsuite/libgomp.c/scan-17.c: Ditto.
> * testsuite/libgomp.c/scan-18.c: Ditto.
> * testsuite/libgomp.c/scan-19.c: Ditto.
> * testsuite/libgomp.c/scan-20.c: Ditto.
> * testsuite/libgomp.c/scan-21.c: Ditto.
> * testsuite/libgomp.c/scan-22.c: Ditto.
I don't think this is the right thing to do.
This just means that at some point between 2013 when -fsimd-cost-model has
been introduced and now -fsimd-cost-model= option at least partially stopped
working properly.
As documented, -fsimd-cost-model= overrides the -fvect-cost-model= setting
for OpenMP simd loops (loop->force_vectorize is true) if specified differently
from default.
In tree-vectorizer.h we have:
static inline bool
unlimited_cost_model (loop_p loop)
{
if (loop != NULL && loop->force_vectorize
&& flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
}
and use it in various places, but we also just use flag_vect_cost_model
in lots of places (and in one spot use flag_simd_cost_model, not sure if
we are sure it is a force_vectorize loop or what).
So, IMHO we should change the above inline function to
loop_cost_model and let it return the cost model and then just
reimplement unlimited_cost_model as
return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
and then adjust the direct uses of the flag and revert these changes.
Jakub
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] vectorizer: Fix up -fsimd-cost-model= handling
2021-10-11 9:28 ` [PATCH] Adjust more testcases " Jakub Jelinek
@ 2021-10-11 12:15 ` Jakub Jelinek
2021-10-11 12:24 ` Richard Biener
2021-10-11 12:27 ` Hongtao Liu
0 siblings, 2 replies; 9+ messages in thread
From: Jakub Jelinek @ 2021-10-11 12:15 UTC (permalink / raw)
To: Richard Biener, liuhongt; +Cc: gcc-patches
On Mon, Oct 11, 2021 at 11:28:55AM +0200, Jakub Jelinek via Gcc-patches wrote:
> I don't think this is the right thing to do.
> This just means that at some point between 2013 when -fsimd-cost-model has
> been introduced and now -fsimd-cost-model= option at least partially stopped
> working properly.
> As documented, -fsimd-cost-model= overrides the -fvect-cost-model= setting
> for OpenMP simd loops (loop->force_vectorize is true) if specified differently
> from default.
> In tree-vectorizer.h we have:
> static inline bool
> unlimited_cost_model (loop_p loop)
> {
> if (loop != NULL && loop->force_vectorize
> && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
> return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
> }
> and use it in various places, but we also just use flag_vect_cost_model
> in lots of places (and in one spot use flag_simd_cost_model, not sure if
> we are sure it is a force_vectorize loop or what).
>
> So, IMHO we should change the above inline function to
> loop_cost_model and let it return the cost model and then just
> reimplement unlimited_cost_model as
> return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
> and then adjust the direct uses of the flag and revert these changes.
Here is a patch that implements it.
Ok for trunk if it passes bootstrap/regtest?
2021-10-11 Jakub Jelinek <jakub@redhat.com>
gcc/
* tree-vectorizer.h (loop_cost_model): New function.
(unlimited_cost_model): Use it.
* tree-vect-loop.c (vect_analyze_loop_costing): Use loop_cost_model
call instead of flag_vect_cost_model.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
(vect_prune_runtime_alias_test_list): Likewise. Also use it instead
of flag_simd_cost_model.
libgomp/
* testsuite/libgomp.c/scan-11.c: Remove option -fvect-cost-model=cheap.
* testsuite/libgomp.c/scan-12.c: Likewise.
* testsuite/libgomp.c/scan-13.c: Likewise.
* testsuite/libgomp.c/scan-14.c: Likewise.
* testsuite/libgomp.c/scan-15.c: Likewise.
* testsuite/libgomp.c/scan-16.c: Likewise.
* testsuite/libgomp.c/scan-17.c: Likewise.
* testsuite/libgomp.c/scan-18.c: Likewise.
* testsuite/libgomp.c/scan-19.c: Likewise.
* testsuite/libgomp.c/scan-20.c: Likewise.
* testsuite/libgomp.c/scan-21.c: Likewise.
* testsuite/libgomp.c/scan-22.c: Likewise.
* testsuite/libgomp.c++/scan-9.C: Likewise.
* testsuite/libgomp.c++/scan-10.C: Likewise.
* testsuite/libgomp.c++/scan-11.C: Likewise.
* testsuite/libgomp.c++/scan-12.C: Likewise.
* testsuite/libgomp.c++/scan-13.C: Likewise.
* testsuite/libgomp.c++/scan-14.C: Likewise.
* testsuite/libgomp.c++/scan-15.C: Likewise.
* testsuite/libgomp.c++/scan-16.C: Likewise.
--- gcc/tree-vectorizer.h.jj 2021-09-27 10:47:15.839084866 +0200
+++ gcc/tree-vectorizer.h 2021-10-11 13:46:55.169767481 +0200
@@ -1701,14 +1701,22 @@ get_dr_vinfo_offset (vec_info *vinfo,
}
+/* Return the vect cost model for LOOP. */
+static inline enum vect_cost_model
+loop_cost_model (loop_p loop)
+{
+ if (loop != NULL
+ && loop->force_vectorize
+ && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
+ return flag_simd_cost_model;
+ return flag_vect_cost_model;
+}
+
/* Return true if the vect cost model is unlimited. */
static inline bool
unlimited_cost_model (loop_p loop)
{
- if (loop != NULL && loop->force_vectorize
- && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
- return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
- return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
+ return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
}
/* Return true if the loop described by LOOP_VINFO is fully-masked and
--- gcc/tree-vect-loop.c.jj 2021-09-22 09:25:15.199030463 +0200
+++ gcc/tree-vect-loop.c 2021-10-11 13:48:33.183366790 +0200
@@ -1850,7 +1850,7 @@ vect_analyze_loop_costing (loop_vec_info
/* If using the "very cheap" model. reject cases in which we'd keep
a copy of the scalar code (even if we might be able to vectorize it). */
- if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
+ if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
&& (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo)
|| LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
|| LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)))
@@ -1922,7 +1922,7 @@ vect_analyze_loop_costing (loop_vec_info
/* If the vector loop needs multiple iterations to be beneficial then
things are probably too close to call, and the conservative thing
would be to stick with the scalar code. */
- if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
+ if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
&& min_profitable_estimate > (int) vect_vf_for_cost (loop_vinfo))
{
if (dump_enabled_p ())
--- gcc/tree-vect-data-refs.c.jj 2021-09-30 17:12:15.238586878 +0200
+++ gcc/tree-vect-data-refs.c 2021-10-11 13:51:48.491576058 +0200
@@ -2236,7 +2236,7 @@ vect_enhance_data_refs_alignment (loop_v
{
unsigned max_allowed_peel
= param_vect_max_peeling_for_alignment;
- if (flag_vect_cost_model <= VECT_COST_MODEL_CHEAP)
+ if (loop_cost_model (loop) <= VECT_COST_MODEL_CHEAP)
max_allowed_peel = 0;
if (max_allowed_peel != (unsigned)-1)
{
@@ -2334,7 +2334,7 @@ vect_enhance_data_refs_alignment (loop_v
do_versioning
= (optimize_loop_nest_for_speed_p (loop)
&& !loop->inner /* FORNOW */
- && flag_vect_cost_model > VECT_COST_MODEL_CHEAP);
+ && loop_cost_model (loop) > VECT_COST_MODEL_CHEAP);
if (do_versioning)
{
@@ -3751,7 +3751,9 @@ vect_prune_runtime_alias_test_list (loop
unsigned int count = (comp_alias_ddrs.length ()
+ check_unequal_addrs.length ());
- if (count && flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP)
+ if (count
+ && (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo))
+ == VECT_COST_MODEL_VERY_CHEAP))
return opt_result::failure_at
(vect_location, "would need a runtime alias check\n");
@@ -3760,7 +3762,7 @@ vect_prune_runtime_alias_test_list (loop
"improved number of alias checks from %d to %d\n",
may_alias_ddrs.length (), count);
unsigned limit = param_vect_max_version_for_alias_checks;
- if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP)
+ if (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo)) == VECT_COST_MODEL_CHEAP)
limit = param_vect_max_version_for_alias_checks * 6 / 10;
if (count > limit)
return opt_result::failure_at
--- libgomp/testsuite/libgomp.c/scan-11.c.jj 2021-10-10 12:12:28.366333440 +0200
+++ libgomp/testsuite/libgomp.c/scan-11.c 2021-10-11 13:53:36.090038707 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-12.c.jj 2021-10-10 12:12:28.366333440 +0200
+++ libgomp/testsuite/libgomp.c/scan-12.c 2021-10-11 13:53:40.186980174 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-13.c.jj 2021-10-10 12:12:28.366333440 +0200
+++ libgomp/testsuite/libgomp.c/scan-13.c 2021-10-11 13:53:43.538932282 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-14.c.jj 2021-10-10 12:12:28.366333440 +0200
+++ libgomp/testsuite/libgomp.c/scan-14.c 2021-10-11 13:53:46.637888006 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-15.c.jj 2021-10-10 12:12:28.366333440 +0200
+++ libgomp/testsuite/libgomp.c/scan-15.c 2021-10-11 13:53:49.891841513 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-16.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-16.c 2021-10-11 13:53:52.908798405 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-17.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-17.c 2021-10-11 13:53:55.940755086 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-18.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-18.c 2021-10-11 13:53:58.739715092 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-19.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-19.c 2021-10-11 13:54:01.640673646 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-20.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-20.c 2021-10-11 13:54:05.757614824 +0200
@@ -1,5 +1,5 @@
/* { dg-require-effective-target size32plus } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
--- libgomp/testsuite/libgomp.c/scan-21.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-21.c 2021-10-11 13:54:09.852556318 +0200
@@ -1,6 +1,6 @@
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target avx_runtime } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
#include "scan-13.c"
--- libgomp/testsuite/libgomp.c/scan-22.c.jj 2021-10-10 12:12:28.367333426 +0200
+++ libgomp/testsuite/libgomp.c/scan-22.c 2021-10-11 13:54:14.516489679 +0200
@@ -1,6 +1,6 @@
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target avx_runtime } */
-/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
+/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
/* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
#include "scan-17.c"
--- libgomp/testsuite/libgomp.c++/scan-9.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-9.C 2021-10-11 13:54:47.256021904 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-10.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-10.C 2021-10-11 13:54:50.123980925 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-11.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-11.C 2021-10-11 13:54:54.256921875 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-12.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-12.C 2021-10-11 13:54:57.077881570 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-13.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-13.C 2021-10-11 13:55:00.164837465 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-14.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-14.C 2021-10-11 13:55:03.960783227 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-15.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-15.C 2021-10-11 13:55:06.864741739 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
--- libgomp/testsuite/libgomp.c++/scan-16.C.jj 2021-10-10 12:12:28.000000000 +0200
+++ libgomp/testsuite/libgomp.c++/scan-16.C 2021-10-11 13:55:09.861698918 +0200
@@ -1,5 +1,5 @@
// { dg-require-effective-target size32plus }
-// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
+// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
// { dg-additional-options "-msse2" { target sse2_runtime } }
// { dg-additional-options "-mavx" { target avx_runtime } }
// { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
Jakub
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] vectorizer: Fix up -fsimd-cost-model= handling
2021-10-11 12:15 ` [PATCH] vectorizer: Fix up -fsimd-cost-model= handling Jakub Jelinek
@ 2021-10-11 12:24 ` Richard Biener
2021-10-11 12:27 ` Hongtao Liu
1 sibling, 0 replies; 9+ messages in thread
From: Richard Biener @ 2021-10-11 12:24 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: liuhongt, gcc-patches
On Mon, 11 Oct 2021, Jakub Jelinek wrote:
> On Mon, Oct 11, 2021 at 11:28:55AM +0200, Jakub Jelinek via Gcc-patches wrote:
> > I don't think this is the right thing to do.
> > This just means that at some point between 2013 when -fsimd-cost-model has
> > been introduced and now -fsimd-cost-model= option at least partially stopped
> > working properly.
> > As documented, -fsimd-cost-model= overrides the -fvect-cost-model= setting
> > for OpenMP simd loops (loop->force_vectorize is true) if specified differently
> > from default.
> > In tree-vectorizer.h we have:
> > static inline bool
> > unlimited_cost_model (loop_p loop)
> > {
> > if (loop != NULL && loop->force_vectorize
> > && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> > return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
> > return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
> > }
> > and use it in various places, but we also just use flag_vect_cost_model
> > in lots of places (and in one spot use flag_simd_cost_model, not sure if
> > we are sure it is a force_vectorize loop or what).
> >
> > So, IMHO we should change the above inline function to
> > loop_cost_model and let it return the cost model and then just
> > reimplement unlimited_cost_model as
> > return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
> > and then adjust the direct uses of the flag and revert these changes.
>
> Here is a patch that implements it.
> Ok for trunk if it passes bootstrap/regtest?
OK.
I'll note that we have #pragma GCC vect set force_vectorize as well
so we'd eventually want the cost model to be used stored in struct loop?
I suppose different -fvect-cost-model settings also prevent inlining
at the moment (and we could likely handle more opt settings as to be
reflected into struct loop to lessen issues like that).
Thanks,
Richard.
> 2021-10-11 Jakub Jelinek <jakub@redhat.com>
>
> gcc/
> * tree-vectorizer.h (loop_cost_model): New function.
> (unlimited_cost_model): Use it.
> * tree-vect-loop.c (vect_analyze_loop_costing): Use loop_cost_model
> call instead of flag_vect_cost_model.
> * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
> (vect_prune_runtime_alias_test_list): Likewise. Also use it instead
> of flag_simd_cost_model.
> libgomp/
> * testsuite/libgomp.c/scan-11.c: Remove option -fvect-cost-model=cheap.
> * testsuite/libgomp.c/scan-12.c: Likewise.
> * testsuite/libgomp.c/scan-13.c: Likewise.
> * testsuite/libgomp.c/scan-14.c: Likewise.
> * testsuite/libgomp.c/scan-15.c: Likewise.
> * testsuite/libgomp.c/scan-16.c: Likewise.
> * testsuite/libgomp.c/scan-17.c: Likewise.
> * testsuite/libgomp.c/scan-18.c: Likewise.
> * testsuite/libgomp.c/scan-19.c: Likewise.
> * testsuite/libgomp.c/scan-20.c: Likewise.
> * testsuite/libgomp.c/scan-21.c: Likewise.
> * testsuite/libgomp.c/scan-22.c: Likewise.
> * testsuite/libgomp.c++/scan-9.C: Likewise.
> * testsuite/libgomp.c++/scan-10.C: Likewise.
> * testsuite/libgomp.c++/scan-11.C: Likewise.
> * testsuite/libgomp.c++/scan-12.C: Likewise.
> * testsuite/libgomp.c++/scan-13.C: Likewise.
> * testsuite/libgomp.c++/scan-14.C: Likewise.
> * testsuite/libgomp.c++/scan-15.C: Likewise.
> * testsuite/libgomp.c++/scan-16.C: Likewise.
>
> --- gcc/tree-vectorizer.h.jj 2021-09-27 10:47:15.839084866 +0200
> +++ gcc/tree-vectorizer.h 2021-10-11 13:46:55.169767481 +0200
> @@ -1701,14 +1701,22 @@ get_dr_vinfo_offset (vec_info *vinfo,
> }
>
>
> +/* Return the vect cost model for LOOP. */
> +static inline enum vect_cost_model
> +loop_cost_model (loop_p loop)
> +{
> + if (loop != NULL
> + && loop->force_vectorize
> + && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> + return flag_simd_cost_model;
> + return flag_vect_cost_model;
> +}
> +
> /* Return true if the vect cost model is unlimited. */
> static inline bool
> unlimited_cost_model (loop_p loop)
> {
> - if (loop != NULL && loop->force_vectorize
> - && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> - return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
> - return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
> + return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
> }
>
> /* Return true if the loop described by LOOP_VINFO is fully-masked and
> --- gcc/tree-vect-loop.c.jj 2021-09-22 09:25:15.199030463 +0200
> +++ gcc/tree-vect-loop.c 2021-10-11 13:48:33.183366790 +0200
> @@ -1850,7 +1850,7 @@ vect_analyze_loop_costing (loop_vec_info
>
> /* If using the "very cheap" model. reject cases in which we'd keep
> a copy of the scalar code (even if we might be able to vectorize it). */
> - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
> + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
> && (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo)
> || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
> || LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)))
> @@ -1922,7 +1922,7 @@ vect_analyze_loop_costing (loop_vec_info
> /* If the vector loop needs multiple iterations to be beneficial then
> things are probably too close to call, and the conservative thing
> would be to stick with the scalar code. */
> - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
> + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
> && min_profitable_estimate > (int) vect_vf_for_cost (loop_vinfo))
> {
> if (dump_enabled_p ())
> --- gcc/tree-vect-data-refs.c.jj 2021-09-30 17:12:15.238586878 +0200
> +++ gcc/tree-vect-data-refs.c 2021-10-11 13:51:48.491576058 +0200
> @@ -2236,7 +2236,7 @@ vect_enhance_data_refs_alignment (loop_v
> {
> unsigned max_allowed_peel
> = param_vect_max_peeling_for_alignment;
> - if (flag_vect_cost_model <= VECT_COST_MODEL_CHEAP)
> + if (loop_cost_model (loop) <= VECT_COST_MODEL_CHEAP)
> max_allowed_peel = 0;
> if (max_allowed_peel != (unsigned)-1)
> {
> @@ -2334,7 +2334,7 @@ vect_enhance_data_refs_alignment (loop_v
> do_versioning
> = (optimize_loop_nest_for_speed_p (loop)
> && !loop->inner /* FORNOW */
> - && flag_vect_cost_model > VECT_COST_MODEL_CHEAP);
> + && loop_cost_model (loop) > VECT_COST_MODEL_CHEAP);
>
> if (do_versioning)
> {
> @@ -3751,7 +3751,9 @@ vect_prune_runtime_alias_test_list (loop
> unsigned int count = (comp_alias_ddrs.length ()
> + check_unequal_addrs.length ());
>
> - if (count && flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP)
> + if (count
> + && (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo))
> + == VECT_COST_MODEL_VERY_CHEAP))
> return opt_result::failure_at
> (vect_location, "would need a runtime alias check\n");
>
> @@ -3760,7 +3762,7 @@ vect_prune_runtime_alias_test_list (loop
> "improved number of alias checks from %d to %d\n",
> may_alias_ddrs.length (), count);
> unsigned limit = param_vect_max_version_for_alias_checks;
> - if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP)
> + if (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo)) == VECT_COST_MODEL_CHEAP)
> limit = param_vect_max_version_for_alias_checks * 6 / 10;
> if (count > limit)
> return opt_result::failure_at
> --- libgomp/testsuite/libgomp.c/scan-11.c.jj 2021-10-10 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-11.c 2021-10-11 13:53:36.090038707 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-12.c.jj 2021-10-10 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-12.c 2021-10-11 13:53:40.186980174 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-13.c.jj 2021-10-10 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-13.c 2021-10-11 13:53:43.538932282 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-14.c.jj 2021-10-10 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-14.c 2021-10-11 13:53:46.637888006 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-15.c.jj 2021-10-10 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-15.c 2021-10-11 13:53:49.891841513 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-16.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-16.c 2021-10-11 13:53:52.908798405 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-17.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-17.c 2021-10-11 13:53:55.940755086 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-18.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-18.c 2021-10-11 13:53:58.739715092 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-19.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-19.c 2021-10-11 13:54:01.640673646 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-20.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-20.c 2021-10-11 13:54:05.757614824 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-21.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-21.c 2021-10-11 13:54:09.852556318 +0200
> @@ -1,6 +1,6 @@
> /* { dg-require-effective-target size32plus } */
> /* { dg-require-effective-target avx_runtime } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
>
> #include "scan-13.c"
> --- libgomp/testsuite/libgomp.c/scan-22.c.jj 2021-10-10 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-22.c 2021-10-11 13:54:14.516489679 +0200
> @@ -1,6 +1,6 @@
> /* { dg-require-effective-target size32plus } */
> /* { dg-require-effective-target avx_runtime } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details -msse2 -mno-sse3" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2 -mno-sse3" } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" } } */
>
> #include "scan-17.c"
> --- libgomp/testsuite/libgomp.c++/scan-9.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-9.C 2021-10-11 13:54:47.256021904 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-10.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-10.C 2021-10-11 13:54:50.123980925 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-11.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-11.C 2021-10-11 13:54:54.256921875 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-12.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-12.C 2021-10-11 13:54:57.077881570 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-13.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-13.C 2021-10-11 13:55:00.164837465 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-14.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-14.C 2021-10-11 13:55:03.960783227 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-15.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-15.C 2021-10-11 13:55:06.864741739 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-16.C.jj 2021-10-10 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-16.C 2021-10-11 13:55:09.861698918 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
>
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] vectorizer: Fix up -fsimd-cost-model= handling
2021-10-11 12:15 ` [PATCH] vectorizer: Fix up -fsimd-cost-model= handling Jakub Jelinek
2021-10-11 12:24 ` Richard Biener
@ 2021-10-11 12:27 ` Hongtao Liu
1 sibling, 0 replies; 9+ messages in thread
From: Hongtao Liu @ 2021-10-11 12:27 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Biener, liuhongt, gcc-patches
On Monday, October 11, 2021, Jakub Jelinek via Gcc-patches <
gcc-patches@gcc.gnu.org> wrote:
> On Mon, Oct 11, 2021 at 11:28:55AM +0200, Jakub Jelinek via Gcc-patches
> wrote:
> > I don't think this is the right thing to do.
> > This just means that at some point between 2013 when -fsimd-cost-model
> has
> > been introduced and now -fsimd-cost-model= option at least partially
> stopped
> > working properly.
> > As documented, -fsimd-cost-model= overrides the -fvect-cost-model=
> setting
> > for OpenMP simd loops (loop->force_vectorize is true) if specified
> differently
> > from default.
> > In tree-vectorizer.h we have:
> > static inline bool
> > unlimited_cost_model (loop_p loop)
> > {
> > if (loop != NULL && loop->force_vectorize
> > && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> > return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
> > return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
> > }
> > and use it in various places, but we also just use flag_vect_cost_model
> > in lots of places (and in one spot use flag_simd_cost_model, not sure if
> > we are sure it is a force_vectorize loop or what).
> >
> > So, IMHO we should change the above inline function to
> > loop_cost_model and let it return the cost model and then just
> > reimplement unlimited_cost_model as
> > return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
> > and then adjust the direct uses of the flag and revert these changes.
>
> Here is a patch that implements it.
> Ok for trunk if it passes bootstrap/regtest?
>
> 2021-10-11 Jakub Jelinek <jakub@redhat.com>
>
> gcc/
> * tree-vectorizer.h (loop_cost_model): New function.
> (unlimited_cost_model): Use it.
> * tree-vect-loop.c (vect_analyze_loop_costing): Use loop_cost_model
> call instead of flag_vect_cost_model.
> * tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
> Likewise.
> (vect_prune_runtime_alias_test_list): Likewise. Also use it
> instead
> of flag_simd_cost_model.
> libgomp/
> * testsuite/libgomp.c/scan-11.c: Remove option
> -fvect-cost-model=cheap.
> * testsuite/libgomp.c/scan-12.c: Likewise.
> * testsuite/libgomp.c/scan-13.c: Likewise.
> * testsuite/libgomp.c/scan-14.c: Likewise.
> * testsuite/libgomp.c/scan-15.c: Likewise.
> * testsuite/libgomp.c/scan-16.c: Likewise.
> * testsuite/libgomp.c/scan-17.c: Likewise.
> * testsuite/libgomp.c/scan-18.c: Likewise.
> * testsuite/libgomp.c/scan-19.c: Likewise.
> * testsuite/libgomp.c/scan-20.c: Likewise.
> * testsuite/libgomp.c/scan-21.c: Likewise.
> * testsuite/libgomp.c/scan-22.c: Likewise.
> * testsuite/libgomp.c++/scan-9.C: Likewise.
> * testsuite/libgomp.c++/scan-10.C: Likewise.
> * testsuite/libgomp.c++/scan-11.C: Likewise.
> * testsuite/libgomp.c++/scan-12.C: Likewise.
> * testsuite/libgomp.c++/scan-13.C: Likewise.
> * testsuite/libgomp.c++/scan-14.C: Likewise.
> * testsuite/libgomp.c++/scan-15.C: Likewise.
> * testsuite/libgomp.c++/scan-16.C: Likewise.
Also for gcc.dg/gomp/simd-2.c, gcc.dg/gomp/simd-3.c
--- gcc/tree-vectorizer.h.jj 2021-09-27 10:47:15.839084866 +0200
> +++ gcc/tree-vectorizer.h 2021-10-11 13:46:55.169767481 +0200
> @@ -1701,14 +1701,22 @@ get_dr_vinfo_offset (vec_info *vinfo,
> }
>
>
> +/* Return the vect cost model for LOOP. */
> +static inline enum vect_cost_model
> +loop_cost_model (loop_p loop)
> +{
> + if (loop != NULL
> + && loop->force_vectorize
> + && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> + return flag_simd_cost_model;
> + return flag_vect_cost_model;
> +}
> +
> /* Return true if the vect cost model is unlimited. */
> static inline bool
> unlimited_cost_model (loop_p loop)
> {
> - if (loop != NULL && loop->force_vectorize
> - && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
> - return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
> - return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
> + return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
> }
>
> /* Return true if the loop described by LOOP_VINFO is fully-masked and
> --- gcc/tree-vect-loop.c.jj 2021-09-22 09:25:15.199030463 +0200
> +++ gcc/tree-vect-loop.c 2021-10-11 13:48:33.183366790 +0200
> @@ -1850,7 +1850,7 @@ vect_analyze_loop_costing (loop_vec_info
>
> /* If using the "very cheap" model. reject cases in which we'd keep
> a copy of the scalar code (even if we might be able to vectorize
> it). */
> - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
> + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
> && (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo)
> || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
> || LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)))
> @@ -1922,7 +1922,7 @@ vect_analyze_loop_costing (loop_vec_info
> /* If the vector loop needs multiple iterations to be beneficial then
> things are probably too close to call, and the conservative thing
> would be to stick with the scalar code. */
> - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP
> + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP
> && min_profitable_estimate > (int) vect_vf_for_cost (loop_vinfo))
> {
> if (dump_enabled_p ())
> --- gcc/tree-vect-data-refs.c.jj 2021-09-30 17:12:15.238586878 +0200
> +++ gcc/tree-vect-data-refs.c 2021-10-11 13:51:48.491576058 +0200
> @@ -2236,7 +2236,7 @@ vect_enhance_data_refs_alignment (loop_v
> {
> unsigned max_allowed_peel
> = param_vect_max_peeling_for_alignment;
> - if (flag_vect_cost_model <= VECT_COST_MODEL_CHEAP)
> + if (loop_cost_model (loop) <= VECT_COST_MODEL_CHEAP)
> max_allowed_peel = 0;
> if (max_allowed_peel != (unsigned)-1)
> {
> @@ -2334,7 +2334,7 @@ vect_enhance_data_refs_alignment (loop_v
> do_versioning
> = (optimize_loop_nest_for_speed_p (loop)
> && !loop->inner /* FORNOW */
> - && flag_vect_cost_model > VECT_COST_MODEL_CHEAP);
> + && loop_cost_model (loop) > VECT_COST_MODEL_CHEAP);
>
> if (do_versioning)
> {
> @@ -3751,7 +3751,9 @@ vect_prune_runtime_alias_test_list (loop
> unsigned int count = (comp_alias_ddrs.length ()
> + check_unequal_addrs.length ());
>
> - if (count && flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP)
> + if (count
> + && (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo))
> + == VECT_COST_MODEL_VERY_CHEAP))
> return opt_result::failure_at
> (vect_location, "would need a runtime alias check\n");
>
> @@ -3760,7 +3762,7 @@ vect_prune_runtime_alias_test_list (loop
> "improved number of alias checks from %d to %d\n",
> may_alias_ddrs.length (), count);
> unsigned limit = param_vect_max_version_for_alias_checks;
> - if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP)
> + if (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo)) ==
> VECT_COST_MODEL_CHEAP)
> limit = param_vect_max_version_for_alias_checks * 6 / 10;
> if (count > limit)
> return opt_result::failure_at
> --- libgomp/testsuite/libgomp.c/scan-11.c.jj 2021-10-10
> 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-11.c 2021-10-11
> 13:53:36.090038707 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-12.c.jj 2021-10-10
> 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-12.c 2021-10-11
> 13:53:40.186980174 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-13.c.jj 2021-10-10
> 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-13.c 2021-10-11
> 13:53:43.538932282 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-14.c.jj 2021-10-10
> 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-14.c 2021-10-11
> 13:53:46.637888006 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-15.c.jj 2021-10-10
> 12:12:28.366333440 +0200
> +++ libgomp/testsuite/libgomp.c/scan-15.c 2021-10-11
> 13:53:49.891841513 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-16.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-16.c 2021-10-11
> 13:53:52.908798405 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-17.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-17.c 2021-10-11
> 13:53:55.940755086 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-18.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-18.c 2021-10-11
> 13:53:58.739715092 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-19.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-19.c 2021-10-11
> 13:54:01.640673646 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-20.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-20.c 2021-10-11
> 13:54:05.757614824 +0200
> @@ -1,5 +1,5 @@
> /* { dg-require-effective-target size32plus } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
> /* { dg-additional-options "-msse2" { target sse2_runtime } } */
> /* { dg-additional-options "-mavx" { target avx_runtime } } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } } */
> --- libgomp/testsuite/libgomp.c/scan-21.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-21.c 2021-10-11
> 13:54:09.852556318 +0200
> @@ -1,6 +1,6 @@
> /* { dg-require-effective-target size32plus } */
> /* { dg-require-effective-target avx_runtime } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details -msse2 -mno-sse3" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2
> -mno-sse3" } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" }
> } */
>
> #include "scan-13.c"
> --- libgomp/testsuite/libgomp.c/scan-22.c.jj 2021-10-10
> 12:12:28.367333426 +0200
> +++ libgomp/testsuite/libgomp.c/scan-22.c 2021-10-11
> 13:54:14.516489679 +0200
> @@ -1,6 +1,6 @@
> /* { dg-require-effective-target size32plus } */
> /* { dg-require-effective-target avx_runtime } */
> -/* { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details -msse2 -mno-sse3" } */
> +/* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details -msse2
> -mno-sse3" } */
> /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" }
> } */
>
> #include "scan-17.c"
> --- libgomp/testsuite/libgomp.c++/scan-9.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-9.C 2021-10-11
> 13:54:47.256021904 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-10.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-10.C 2021-10-11
> 13:54:50.123980925 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-11.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-11.C 2021-10-11
> 13:54:54.256921875 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-12.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-12.C 2021-10-11
> 13:54:57.077881570 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-13.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-13.C 2021-10-11
> 13:55:00.164837465 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-14.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-14.C 2021-10-11
> 13:55:03.960783227 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fvect-cost-model=cheap -fopenmp
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-15.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-15.C 2021-10-11
> 13:55:06.864741739 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
> --- libgomp/testsuite/libgomp.c++/scan-16.C.jj 2021-10-10
> 12:12:28.000000000 +0200
> +++ libgomp/testsuite/libgomp.c++/scan-16.C 2021-10-11
> 13:55:09.861698918 +0200
> @@ -1,5 +1,5 @@
> // { dg-require-effective-target size32plus }
> -// { dg-additional-options "-O2 -fopenmp -fvect-cost-model=cheap
> -fdump-tree-vect-details" }
> +// { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
> // { dg-additional-options "-msse2" { target sse2_runtime } }
> // { dg-additional-options "-mavx" { target avx_runtime } }
> // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" {
> target sse2_runtime } } }
>
>
> Jakub
>
>
--
BR,
Hongtao
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-11 12:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 4:55 [PATCH] Adjust more testcases for O2 vectorization enabling liuhongt
2021-10-09 21:36 ` H.J. Lu
2021-10-11 2:10 ` [PATCH] Adjust testcase " liuhongt
2021-10-11 2:22 ` Kewen.Lin
2021-10-11 2:39 ` Hongtao Liu
2021-10-11 9:28 ` [PATCH] Adjust more testcases " Jakub Jelinek
2021-10-11 12:15 ` [PATCH] vectorizer: Fix up -fsimd-cost-model= handling Jakub Jelinek
2021-10-11 12:24 ` Richard Biener
2021-10-11 12:27 ` Hongtao Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).