diff options
author | Feng Xue <fxue@os.amperecomputing.com> | 2024-06-15 23:17:10 +0800 |
---|---|---|
committer | Feng Xue <fxue@os.amperecomputing.com> | 2024-06-20 10:35:38 +0800 |
commit | 70466e6f9d9fb87f78ffe2e397ca876b380cb493 (patch) | |
tree | 090edef1f11732443da8e4ab8e91e8f83ca19cba /gcc/tree-vectorizer.h | |
parent | ebfffb6c6557f1375c230ae6751f697cdfab4a60 (diff) | |
download | gcc-70466e6f9d9fb87f78ffe2e397ca876b380cb493.zip gcc-70466e6f9d9fb87f78ffe2e397ca876b380cb493.tar.gz gcc-70466e6f9d9fb87f78ffe2e397ca876b380cb493.tar.bz2 |
vect: Add a function to check lane-reducing stmt
Add a utility function to check if a statement is lane-reducing operation,
which could simplify some existing code.
2024-06-16 Feng Xue <fxue@os.amperecomputing.com>
gcc/
* tree-vectorizer.h (lane_reducing_stmt_p): New function.
* tree-vect-slp.cc (vect_analyze_slp): Use new function
lane_reducing_stmt_p to check statement.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 6bb0f5c..60224f4 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2169,12 +2169,24 @@ vect_apply_runtime_profitability_check_p (loop_vec_info loop_vinfo) && th >= vect_vf_for_cost (loop_vinfo)); } +/* Return true if CODE is a lane-reducing opcode. */ + inline bool lane_reducing_op_p (code_helper code) { return code == DOT_PROD_EXPR || code == WIDEN_SUM_EXPR || code == SAD_EXPR; } +/* Return true if STMT is a lane-reducing statement. */ + +inline bool +lane_reducing_stmt_p (gimple *stmt) +{ + if (auto *assign = dyn_cast <gassign *> (stmt)) + return lane_reducing_op_p (gimple_assign_rhs_code (assign)); + return false; +} + /* Source location + hotness information. */ extern dump_user_location_t vect_location; |