This fixes a few omissions in generalizing strided load support.

Bootstrap and regtest on x86_64-unknown-linux-gnu is running.

Richard.

2012-05-14  Richard Guenther  <rguent...@suse.de>

        PR tree-optimization/53331
        * tree-vect-data-refs.c (vect_verify_datarefs_alignment): Ignore
        strided loads.
        * tree-vect-stmts.c (vect_model_load_cost): Handle strided loads.

Index: gcc/tree-vect-data-refs.c
===================================================================
*** gcc/tree-vect-data-refs.c   (revision 187456)
--- gcc/tree-vect-data-refs.c   (working copy)
*************** vect_verify_datarefs_alignment (loop_vec
*** 1078,1083 ****
--- 1078,1088 ----
            || !STMT_VINFO_VECTORIZABLE (stmt_info))
          continue;
  
+       /* Strided loads perform only component accesses, alignment is
+        irrelevant for them.  */
+       if (STMT_VINFO_STRIDE_LOAD_P (stmt_info))
+       continue;
+ 
        supportable_dr_alignment = vect_supportable_dr_alignment (dr, false);
        if (!supportable_dr_alignment)
          {
Index: gcc/tree-vect-stmts.c
===================================================================
*** gcc/tree-vect-stmts.c       (revision 187456)
--- gcc/tree-vect-stmts.c       (working copy)
*************** vect_model_load_cost (stmt_vec_info stmt
*** 1032,1041 ****
      }
  
    /* The loads themselves.  */
!   vect_get_load_cost (first_dr, ncopies,
!          ((!STMT_VINFO_GROUPED_ACCESS (stmt_info)) || group_size > 1
!           || slp_node),
!          &inside_cost, &outside_cost);
  
    if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_load_cost: inside_cost = %d, "
--- 1032,1050 ----
      }
  
    /* The loads themselves.  */
!   if (STMT_VINFO_STRIDE_LOAD_P (stmt_info))
!     {
!       /* N scalar loads plus gathering them into a vector.
!          ???  scalar_to_vec isn't the cost for that.  */
!       inside_cost += (vect_get_stmt_cost (scalar_load) * ncopies
!                     * TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)));
!       inside_cost += ncopies * vect_get_stmt_cost (scalar_to_vec);
!     }
!   else
!     vect_get_load_cost (first_dr, ncopies,
!                       ((!STMT_VINFO_GROUPED_ACCESS (stmt_info))
!                        || group_size > 1 || slp_node),
!                       &inside_cost, &outside_cost);
  
    if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_load_cost: inside_cost = %d, "

Reply via email to