[PATCH] Fix PR68707
authoralalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jan 2016 18:02:35 +0000 (18:02 +0000)
committeralalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jan 2016 18:02:35 +0000 (18:02 +0000)
gcc/:
* tree-vect-slp.c (vect_analyze_slp_instance): Cancel permuted SLP
instances that can be handled via vect_load_lanes.

gcc/testsuite/:

* lib/target-supports.exp (check_effective_target_vect_load_lanes): New.
* gcc.dg/vect/slp-perm-1.c: Look for vect_load_lanes instead of SLP
on platforms supporting it.
* gcc.dg/vect/slp-perm-2.c: Likewise.
* gcc.dg/vect/slp-perm-3.c: Likewise.
* gcc.dg/vect/slp-perm-5.c: Likewise.
* gcc.dg/vect/slp-perm-7.c: Likewise.
* gcc.dg/vect/slp-perm-8.c: Likewise.
* gcc.dg/vect/slp-perm-6.c: Look for vect_load_lanes in addition to SLP
on platforms supporting it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232174 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/slp-perm-1.c
gcc/testsuite/gcc.dg/vect/slp-perm-2.c
gcc/testsuite/gcc.dg/vect/slp-perm-3.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/lib/target-supports.exp
gcc/tree-vect-slp.c

index c3524fc..2cb0b01 100644 (file)
@@ -1,3 +1,10 @@
+2016-01-08  Alan Lawrence  <alan.lawrence@arm.com>
+       Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68707
+       * tree-vect-slp.c (vect_analyze_slp_instance): Cancel permuted SLP
+       instances that can be handled via vect_load_lanes.
+
 2016-01-08  Uros Bizjak  <ubizjak@gmail.com>
 
        * symtab.c (symtab_node::equal_address_to): Return -1 instead of 2
index f455fa2..235eab7 100644 (file)
@@ -1,3 +1,17 @@
+2016-01-08  Alan Lawrence  <alan.lawrence@arm.com>
+
+       PR tree-optimization/68707
+       * lib/target-supports.exp (check_effective_target_vect_load_lanes): New.
+       * gcc.dg/vect/slp-perm-1.c: Look for vect_load_lanes instead of SLP
+       on platforms supporting it.
+       * gcc.dg/vect/slp-perm-2.c: Likewise.
+       * gcc.dg/vect/slp-perm-3.c: Likewise.
+       * gcc.dg/vect/slp-perm-5.c: Likewise.
+       * gcc.dg/vect/slp-perm-7.c: Likewise.
+       * gcc.dg/vect/slp-perm-8.c: Likewise.
+       * gcc.dg/vect/slp-perm-6.c: Look for vect_load_lanes in addition to SLP
+       on platforms supporting it.
+
 2016-01-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/69162
index 2b6c134..6d0d66f 100644 (file)
@@ -58,5 +58,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_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
 
index da50e16..34b413d 100644 (file)
@@ -54,5 +54,8 @@ 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_perm } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
index 1d33f9b..ec13e0f 100644 (file)
@@ -67,6 +67,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_perm } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
 
index 9ed4d72..f44f44f 100644 (file)
@@ -73,6 +73,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_perm } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
 
index 392d36f..551734a 100644 (file)
@@ -72,5 +72,8 @@ 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_perm } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
index 4352334..8b66142 100644 (file)
@@ -71,6 +71,8 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */
-
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
index 3bdd150..b1e9a10 100644 (file)
@@ -54,5 +54,8 @@ int main (int argc, const char* argv[])
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { vect_perm_byte && vect_char_mult } } } } */
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_byte && {! vect_char_mult } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm_byte } } } */
-
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm_byte && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" { target { vect_perm_byte && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
index 4030b35..31a4f60 100644 (file)
@@ -4876,6 +4876,25 @@ proc check_effective_target_vect_element_align { } {
     return $et_vect_element_align
 }
 
+# Return 1 if the target supports vector LOAD_LANES operations, 0 otherwise.
+
+proc check_effective_target_vect_load_lanes { } {
+    global et_vect_load_lanes
+
+    if [info exists et_vect_load_lanes] {
+       verbose "check_effective_target_vect_load_lanes: using cached result" 2
+    } else {
+       set et_vect_load_lanes 0
+       if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])
+            || [istarget aarch64*-*-*] } {
+           set et_vect_load_lanes 1
+       }
+    }
+
+    verbose "check_effective_target_vect_load_lanes: returning $et_vect_load_lanes" 2
+    return $et_vect_load_lanes
+}
+
 # Return 1 if the target supports vector conditional operations, 0 otherwise.
 
 proc check_effective_target_vect_condition { } {
index b029f61..0aac2e2 100644 (file)
@@ -1820,6 +1820,36 @@ vect_analyze_slp_instance (vec_info *vinfo,
             }
         }
 
+      /* If the loads and stores can be handled with load/store-lane
+        instructions do not generate this SLP instance.  */
+      if (is_a <loop_vec_info> (vinfo)
+         && loads_permuted
+         && dr && vect_store_lanes_supported (vectype, group_size))
+       {
+         slp_tree load_node;
+         FOR_EACH_VEC_ELT (loads, i, load_node)
+           {
+             gimple *first_stmt = GROUP_FIRST_ELEMENT
+                 (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0]));
+             stmt_vec_info stmt_vinfo = vinfo_for_stmt (first_stmt);
+             /* Use SLP for strided accesses (or if we can't load-lanes).  */
+             if (STMT_VINFO_STRIDED_P (stmt_vinfo)
+                 || ! vect_load_lanes_supported
+                       (STMT_VINFO_VECTYPE (stmt_vinfo),
+                        GROUP_SIZE (stmt_vinfo)))
+               break;
+           }
+         if (i == loads.length ())
+           {
+             if (dump_enabled_p ())
+               dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                                "Built SLP cancelled: can use "
+                                "load/store-lanes\n");
+             vect_free_slp_instance (new_instance);
+             return false;
+           }
+       }
+
       vinfo->slp_instances.safe_push (new_instance);
 
       if (dump_enabled_p ())