This allows for costing reads from the global HSSR state when costing
HSSR loops.

gcc/ChangeLog:

        * target.h (enum vect_cost_for_stmt): Add hssr_read item.
        * targhooks.cc (default_builtin_vectorization_cost): Add handling
        of hssr_read.
        * tree-vectorizer.cc (dump_stmt_cost): Likewise.
---
 gcc/target.h           | 7 ++++++-
 gcc/targhooks.cc       | 3 +++
 gcc/tree-vectorizer.cc | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/target.h b/gcc/target.h
index 67b04f90f45..8d13846095d 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -213,7 +213,12 @@ enum vect_cost_for_stmt
   vec_perm,
   vec_promote_demote,
   vec_construct,
-  vec_deconstruct
+  vec_deconstruct,
+  /* Represents the costs of reading the HSSR state, detecting if a partial
+     read occurred, and the possible branch to fixup code.
+
+     Does not cost the fixup code itself.  */
+  hssr_read
 };
 
 /* Separate locations for which the vectorizer cost model should
diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc
index 388f696c8aa..2f9db33ef80 100644
--- a/gcc/targhooks.cc
+++ b/gcc/targhooks.cc
@@ -776,6 +776,9 @@ default_builtin_vectorization_cost (enum vect_cost_for_stmt 
type_of_cost,
       case cond_branch_taken:
         return 3;
 
+      case hssr_read:
+       return 4;
+
       case vec_construct:
       case vec_deconstruct:
        return estimated_poly_value (TYPE_VECTOR_SUBPARTS (vectype)) - 1;
diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
index 8c824e4ee33..398edbd7ecc 100644
--- a/gcc/tree-vectorizer.cc
+++ b/gcc/tree-vectorizer.cc
@@ -172,6 +172,9 @@ dump_stmt_cost (FILE *f, int count, enum vect_cost_for_stmt 
kind,
     case vec_deconstruct:
       ks = "vec_deconstruct";
       break;
+    case hssr_read:
+      ks = "hssr_read";
+      break;
     }
   fprintf (f, "%s ", ks);
   if (kind == unaligned_load || kind == unaligned_store)
-- 
2.43.0

Reply via email to