]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Update some vect cases for partial vectors
authorKewen Lin <linkw@gcc.gnu.org>
Mon, 31 Aug 2020 00:52:03 +0000 (19:52 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Mon, 31 Aug 2020 00:52:03 +0000 (19:52 -0500)
This patch is to adjust some existing vectorization test cases
to work well with the newly introduced partial vector usages.

Bootstrapped/regtested on aarch64-linux-gnu and powerpc64le-linux-gnu
P9 (with explicit param vect-partial-vector-usage=1 and enablement on
check_effective_target_vect_partial_vectors_usage_1 check).

gcc/ChangeLog:

* doc/sourcebuild.texi (vect_len_load_store,
vect_partial_vectors_usage_1, vect_partial_vectors_usage_2,
vect_partial_vectors): Document.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-pr69907.c: Adjust for partial vector usages.
* gcc.dg/vect/slp-3.c: Likewise.
* gcc.dg/vect/slp-multitypes-11.c: Likewise.
* gcc.dg/vect/slp-perm-1.c: Likewise.
* gcc.dg/vect/slp-perm-5.c: Likewise.
* gcc.dg/vect/slp-perm-6.c: Likewise.
* gcc.dg/vect/slp-perm-7.c: Likewise.
* gcc.dg/vect/slp-perm-8.c: Likewise.
* gcc.dg/vect/slp-perm-9.c: Likewise.
* gcc.dg/vect/vect-version-2.c: Likewise.
* lib/target-supports.exp (check_vect_partial_vector_usage): New
function.
(check_effective_target_vect_len_load_store): Likewise.
(check_effective_target_vect_partial_vectors_usage_1): Likewise.
(check_effective_target_vect_partial_vectors_usage_2): Likewise.
(check_effective_target_vect_partial_vectors): Likewise.

12 files changed:
gcc/doc/sourcebuild.texi
gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c
gcc/testsuite/gcc.dg/vect/slp-3.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c
gcc/testsuite/gcc.dg/vect/slp-perm-1.c
gcc/testsuite/gcc.dg/vect/slp-perm-5.c
gcc/testsuite/gcc.dg/vect/slp-perm-6.c
gcc/testsuite/gcc.dg/vect/slp-perm-7.c
gcc/testsuite/gcc.dg/vect/slp-perm-8.c
gcc/testsuite/gcc.dg/vect/slp-perm-9.c
gcc/testsuite/gcc.dg/vect/vect-version-2.c
gcc/testsuite/lib/target-supports.exp

index 967cb135cb46b899306389d83bdd89d2e5c49e13..f7c69362f91bd661d91b96919e58196e1bb2194f 100644 (file)
@@ -1711,6 +1711,21 @@ Target supports AND, IOR and XOR reduction on vectors.
 
 @item vect_fold_extract_last
 Target supports the @code{fold_extract_last} optab.
+
+@item vect_len_load_store
+Target supports the @code{len_load} and @code{len_store} optabs.
+
+@item vect_partial_vectors_usage_1
+Target supports loop vectorization with partial vectors and
+@code{vect-partial-vector-usage} is set to 1.
+
+@item vect_partial_vectors_usage_2
+Target supports loop vectorization with partial vectors and
+@code{vect-partial-vector-usage} is set to 2.
+
+@item vect_partial_vectors
+Target supports loop vectorization with partial vectors and
+@code{vect-partial-vector-usage} is nonzero.
 @end table
 
 @subsubsection Thread Local Storage attributes
index fe52d18525a339ce8d7814974bbd5a925762d871..b348526b62f03d06abb42da264a7e74fca2b0b83 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
-/* { dg-additional-options "-O3" } */
+/* Disable for vectorization using partial vectors since it would have only
+   one iteration left, consequently BB vectorization won't happen.  */
+/* { dg-additional-options "-O3 --param=vect-partial-vector-usage=0" } */
 /* { dg-require-effective-target vect_unpack } */
 
 #include "tree-vect.h"
index 5e40499ff9637553983c1ba3a054c2ed257e2006..46ab584419aac4dfd1fd5da0920c67e040f7dc60 100644 (file)
@@ -141,8 +141,8 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_fully_masked } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_fully_masked } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target { ! vect_fully_masked } } } }*/
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target vect_fully_masked } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_partial_vectors } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_partial_vectors } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target { ! vect_partial_vectors } } } }*/
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target vect_partial_vectors } } } */
   
index 5200ed1cd94948a8b5bad59b989d330de2c6bdba..96218861cd61272d24cfc76772139d42172bb757 100644 (file)
@@ -49,5 +49,7 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_unpack } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect"  { target vect_unpack xfail { vect_variable_length && vect_load_lanes } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect"  { target { vect_unpack && {! vect_partial_vectors_usage_1 } } xfail { vect_variable_length && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect"  { target { vect_unpack && vect_partial_vectors_usage_1 } xfail { vect_variable_length && vect_load_lanes } } } } */
   
index ca7803ec1a9a49b4800cf396bcdc05f263f344ee..4128cca024cd36b01f385d6f9db39eec3a65c67d 100644 (file)
@@ -80,7 +80,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
index b86a3dc8756e0d30551a40ed1febb142813190a4..b137821ec3904f6d53ec935eb6f462ba79b62db2 100644 (file)
@@ -104,7 +104,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { ! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
index 97a0ebffe0131c970b53725b87df7d0949b1e2a5..38489291a2659c989121d44c9e9e7bdfaa12f868 100644 (file)
@@ -103,7 +103,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { ! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
index 346411fd5042add21fdc6413922506bcb92f4594..498999ac56ed34da857e2cfad8c4405639e40330 100644 (file)
@@ -96,7 +96,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && { ! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
index 17aa111437af76a5e864b383e27bbc709683c6c6..9e59832fb8b7417069943a74d28ffcd3e15e2215 100644 (file)
@@ -60,7 +60,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_byte } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_byte && { ! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_byte && { { ! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
+/* The epilogues are vectorized using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_byte && { { ! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_byte && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
index c54420abd9d9047e5ae686ae2d0170e8523da134..ab75f44eb756b60cd61f321ff72925a31e0acdaa 100644 (file)
@@ -61,7 +61,9 @@ int main (int argc, const char* argv[])
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_short || vect_load_lanes } } } } */
 /* We don't try permutes with a group size of 3 for variable-length
    vectors.  */
-/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { ! vect_perm3_short } } xfail vect_variable_length } } } */
+/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && { ! vect_partial_vectors_usage_1 } } } xfail vect_variable_length } } } */
+/* Try to vectorize the epilogue using partial vectors.  */
+/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 2 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && vect_partial_vectors_usage_1 } } xfail vect_variable_length } } } */
 /* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! vect_perm3_short } || vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_short && { ! vect_load_lanes } } } } } */
index 0ea39e318018d4b1658fceceed273ee693a05c30..7d3fb722f477c9a55d78f8b6e34b4adafb3617ff 100644 (file)
@@ -17,4 +17,8 @@ void foo (double *x, double *y, int m, int n, int o, int p)
          }
 }
 
-/* { dg-final { scan-tree-dump "reusing loop version created by if conversion" "vect" } } */
+/* Vectorization using partial vectors has zero versioning_threshold with
+   either usage 1 or usage 2, the cond_expr replies on the computation in
+   outer loop, so it doesn't need to reuse the loop version created by if
+   conversion.  */
+/* { dg-final { scan-tree-dump "reusing loop version created by if conversion" "vect" {target {! vect_partial_vectors } } } } */
index f3fc5b80aea34911536de6535c9ca28c9a3d83a6..46e8cddbcca3960bc349a5978a901ced270bbd11 100644 (file)
@@ -7081,6 +7081,67 @@ proc check_effective_target_vect_fully_masked { } {
                   || [istarget amdgcn*-*-*] }]
 }
 
+# Return true if the target supports the @code{len_load} and
+# @code{len_store} optabs.
+
+proc check_effective_target_vect_len_load_store { } {
+    return 0
+}
+
+# Return the value of parameter vect-partial-vector-usage specified for
+# target by checking the output of "-Q --help=params".  Return zero if
+# the desirable pattern isn't found.
+
+proc check_vect_partial_vector_usage { } {
+    global tool
+
+    return [check_cached_effective_target vect_partial_vector_usage {
+      set result [check_compile vect_partial_vector_usage assembly {
+         int i;
+      } "-Q --help=params" ]
+
+      # Get compiler emitted messages and delete generated file.
+      set lines [lindex $result 0]
+      set output [lindex $result 1]
+      remote_file build delete $output
+
+      set pattern {=vect-partial-vector-usage=<0,2>\s+([0-2])}
+      # Capture the usage value to val, set it to zero if not found.
+      if { ![regexp $pattern $lines whole val] } then {
+         set val 0
+      }
+
+      return $val
+    }]
+}
+
+# Return true if the target supports loop vectorization with partial vectors
+# and @code{vect-partial-vector-usage} is set to 1.
+
+proc check_effective_target_vect_partial_vectors_usage_1 { } {
+    return [expr { ([check_effective_target_vect_fully_masked]
+                   || [check_effective_target_vect_len_load_store])
+                  && [check_vect_partial_vector_usage] == 1 }]
+}
+
+# Return true if the target supports loop vectorization with partial vectors
+# and @code{vect-partial-vector-usage} is set to 2.
+
+proc check_effective_target_vect_partial_vectors_usage_2 { } {
+    return [expr { ([check_effective_target_vect_fully_masked]
+                   || [check_effective_target_vect_len_load_store])
+                  && [check_vect_partial_vector_usage] == 2 }]
+}
+
+# Return true if the target supports loop vectorization with partial vectors
+# and @code{vect-partial-vector-usage} is nonzero.
+
+proc check_effective_target_vect_partial_vectors { } {
+    return [expr { ([check_effective_target_vect_fully_masked]
+                   || [check_effective_target_vect_len_load_store])
+                  && [check_vect_partial_vector_usage] != 0 }]
+}
+
 # Return 1 if the target doesn't prefer any alignment beyond element
 # alignment during vectorization.