Add param for controlling HSSR code generation.
gcc/ChangeLog:
* params.opt: New param.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp
(check_effective_target_implements_vect_hssr): New function.
(check_vect_hssr_usage): Likewise.
(check_effective_target_vect_hssr): Likewise.
---
gcc/params.opt | 4 +++
gcc/testsuite/lib/target-supports.exp | 41 +++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/gcc/params.opt b/gcc/params.opt
index 0c6a3e51457..f6ed7a07a0b 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1295,6 +1295,10 @@ Bound on number of runtime checks inserted by the
vectorizer's loop versioning f
Common Joined UInteger Var(param_vect_partial_vector_usage) Init(2)
IntegerRange(0, 2) Param Optimization NoOffload
Controls how loop vectorizer uses partial vectors. 0 means never, 1 means
only for loops whose need to iterate can be removed, 2 means for all loops.
The default value is 2.
+-param=vect-hssr-usage=
+Common Joined UInteger Var(param_vect_hssr_usage) Init(0) IntegerRange(0, 3)
Param Optimization NoOffload
+Controls how loop vectorizer uses hardware safe speculative loads. 0 means
never, 1 means only when profitable, 2 means whenever profitable possibly as a
versioned option, 3 means whenever possible. The default value is 0.
+
-param=vect-inner-loop-cost-factor=
Common Joined UInteger Var(param_vect_inner_loop_cost_factor) Init(50)
IntegerRange(1, 10000) Param Optimization NoOffload
The maximum factor which the loop vectorizer applies to the cost of statements
in an inner loop relative to the loop being vectorized.
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index cbd39301a8b..8876f41a4ae 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9623,6 +9623,47 @@ proc check_effective_target_vect_partial_vectors { } {
&& [check_vect_partial_vector_usage] != 0 }]
}
+# Return true if hssr loops are supported.
+
+proc check_effective_target_implements_vect_hssr { } {
+ return 0
+}
+
+# Return the value of parameter vect-hssr-usage specified for
+# target by checking the output of "-Q --help=params". Return zero if
+# the desirable pattern isn't found.
+
+proc check_vect_hssr_usage { } {
+ global tool
+
+ return [check_cached_effective_target vect_hssr_usage {
+ set result [check_compile vect_hssr_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-hssr-usage=<0,3>\s+([0-3])}
+ # 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 hssr
+# and @code{vect-hssr-usage} is nonzero.
+
+proc check_effective_target_vect_hssr { } {
+ return [expr { [check_effective_target_implements_vect_hssr]
+ && [check_vect_hssr_usage] != 0 }]
+}
+
# Return 1 if the target doesn't prefer any alignment beyond element
# alignment during vectorization.
--
2.43.0