diff options
author | Richard Biener <rguenther@suse.de> | 2023-05-23 15:58:52 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-05-23 17:57:33 +0200 |
commit | 9d5034aad9868bed45472ef5bfac22dd9ac0e0cb (patch) | |
tree | 6c1d5fac2fef0df35f80149a3395feaa91f1d5db | |
parent | c53f51005de1248ef42b08d32875abf73eb42c3c (diff) | |
download | gcc-9d5034aad9868bed45472ef5bfac22dd9ac0e0cb.zip gcc-9d5034aad9868bed45472ef5bfac22dd9ac0e0cb.tar.gz gcc-9d5034aad9868bed45472ef5bfac22dd9ac0e0cb.tar.bz2 |
Generic vector op costing adjustment
This is a small adjustment to the work done for PR108752 and
better reflects the cost of the generated sequence.
PR tree-optimization/108752
* tree-vect-stmts.cc (vectorizable_operation): For bit
operations with generic word_mode vectors do not cost
an extra stmt. For plus, minus and negate also cost the
constant materialization.
-rw-r--r-- | gcc/tree-vect-stmts.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 0022b87..127b987 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -6466,8 +6466,8 @@ vectorizable_operation (vec_info *vinfo, { /* The above vect_model_simple_cost call handles constants in the prologue and (mis-)costs one of the stmts as - vector stmt. See tree-vect-generic.cc:do_plus_minus/do_negate - for the actual lowering that will be applied. */ + vector stmt. See below for the actual lowering that will + be applied. */ unsigned n = slp_node ? SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) : ncopies; switch (code) @@ -6481,9 +6481,20 @@ vectorizable_operation (vec_info *vinfo, case NEGATE_EXPR: n *= 4; break; - default:; + default: + /* Bit operations do not have extra cost and are accounted + as vector stmt by vect_model_simple_cost. */ + n = 0; + break; + } + if (n != 0) + { + /* We also need to materialize two large constants. */ + record_stmt_cost (cost_vec, 2, scalar_stmt, stmt_info, + 0, vect_prologue); + record_stmt_cost (cost_vec, n, scalar_stmt, stmt_info, + 0, vect_body); } - record_stmt_cost (cost_vec, n, scalar_stmt, stmt_info, 0, vect_body); } return true; } |