aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorFeng Xue <fxue@os.amperecomputing.com>2024-05-29 13:12:12 +0800
committerFeng Xue <fxue@os.amperecomputing.com>2024-06-01 08:31:43 +0800
commitc0f31701556c4162463f28bc0f03007f40a6176e (patch)
tree6d3c21cd28a6d3541d798525de3f5e301127924e /gcc/tree-vectorizer.h
parent3c75a4c03da78b434603bc0bd88a1395c3c5b25c (diff)
downloadgcc-c0f31701556c4162463f28bc0f03007f40a6176e.zip
gcc-c0f31701556c4162463f28bc0f03007f40a6176e.tar.gz
gcc-c0f31701556c4162463f28bc0f03007f40a6176e.tar.bz2
vect: Add a function to check lane-reducing code
Check if an operation is lane-reducing requires comparison of code against three kinds (DOT_PROD_EXPR/WIDEN_SUM_EXPR/SAD_EXPR). Add an utility function to make source coding for the check handy and concise. 2024-05-29 Feng Xue <fxue@os.amperecomputing.com> gcc/ * tree-vectorizer.h (lane_reducing_op_p): New function. * tree-vect-slp.cc (vect_analyze_slp): Use new function lane_reducing_op_p to check statement code. * tree-vect-loop.cc (vect_transform_reduction): Likewise. (vectorizable_reduction): Likewise, and change name of a local variable that holds the result flag.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 4798234..97ec9c3 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2169,6 +2169,12 @@ vect_apply_runtime_profitability_check_p (loop_vec_info loop_vinfo)
&& th >= vect_vf_for_cost (loop_vinfo));
}
+inline bool
+lane_reducing_op_p (code_helper code)
+{
+ return code == DOT_PROD_EXPR || code == WIDEN_SUM_EXPR || code == SAD_EXPR;
+}
+
/* Source location + hotness information. */
extern dump_user_location_t vect_location;