diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2023-06-05 17:49:03 +0100 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2023-06-05 17:52:38 +0100 |
commit | fe29963d40a721d18b5f688b9d54dd9021bfb90a (patch) | |
tree | 23fa4fe7b84beba2641df8e2c45edbcd5597fd66 /gcc/tree.h | |
parent | 3ad9313a2e28287aa350d9dc3ea7746d8302662d (diff) | |
download | gcc-fe29963d40a721d18b5f688b9d54dd9021bfb90a.zip gcc-fe29963d40a721d18b5f688b9d54dd9021bfb90a.tar.gz gcc-fe29963d40a721d18b5f688b9d54dd9021bfb90a.tar.bz2 |
vect: Refactor to allow internal_fn's
Refactor vect-patterns to allow patterns to be internal_fns starting
with widening_plus/minus patterns
2023-06-05 Andre Vieira <andre.simoesdiasvieira@arm.com>
Joel Hutton <joel.hutton@arm.com>
gcc/ChangeLog:
* tree-vect-patterns.cc: Add include for gimple-iterator.
(vect_recog_widen_op_pattern): Refactor to use code_helper.
(vect_gimple_build): New function.
* tree-vect-stmts.cc (simple_integer_narrowing): Refactor to use
code_helper.
(vectorizable_call): Likewise.
(vect_gen_widened_results_half): Likewise.
(vect_create_vectorized_demotion_stmts): Likewise.
(vect_create_vectorized_promotion_stmts): Likewise.
(vect_create_half_widening_stmts): Likewise.
(vectorizable_conversion): Likewise.
(supportable_widening_operation): Likewise.
(supportable_narrowing_operation): Likewise.
* tree-vectorizer.h (supportable_widening_operation): Change
prototype to use code_helper.
(supportable_narrowing_operation): Likewise.
(vect_gimple_build): New function prototype.
* tree.h (code_helper::safe_as_tree_code): New function.
(code_helper::safe_as_fn_code): New function.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -93,6 +93,8 @@ public: bool is_internal_fn () const; bool is_builtin_fn () const; int get_rep () const { return rep; } + tree_code safe_as_tree_code () const; + combined_fn safe_as_fn_code () const; bool operator== (const code_helper &other) { return rep == other.rep; } bool operator!= (const code_helper &other) { return rep != other.rep; } bool operator== (tree_code c) { return rep == code_helper (c).rep; } @@ -102,6 +104,25 @@ private: int rep; }; +/* Helper function that returns the tree_code representation of THIS + code_helper if it is a tree_code and MAX_TREE_CODES otherwise. This is + useful when passing a code_helper to a tree_code only check. */ + +inline tree_code +code_helper::safe_as_tree_code () const +{ + return is_tree_code () ? (tree_code) *this : MAX_TREE_CODES; +} + +/* Helper function that returns the combined_fn representation of THIS + code_helper if it is a fn_code and CFN_LAST otherwise. This is useful when + passing a code_helper to a combined_fn only check. */ + +inline combined_fn +code_helper::safe_as_fn_code () const { + return is_fn_code () ? (combined_fn) *this : CFN_LAST; +} + inline code_helper::operator internal_fn () const { return as_internal_fn (combined_fn (*this)); |