diff options
author | Richard Biener <rguenther@suse.de> | 2023-05-02 10:34:48 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-05-02 11:54:00 +0200 |
commit | f385252b2336a4a57a30fddf82e558c73bcc85cc (patch) | |
tree | 790619cdf3037c47048ceace05b656b143132677 | |
parent | 59912ce42eee7f763f8b85f5aa4fd4fcbcffe5b7 (diff) | |
download | gcc-f385252b2336a4a57a30fddf82e558c73bcc85cc.zip gcc-f385252b2336a4a57a30fddf82e558c73bcc85cc.tar.gz gcc-f385252b2336a4a57a30fddf82e558c73bcc85cc.tar.bz2 |
tree-optimization/109672 - properly check emulated plus during vect
The following refactors the check for emulated vector support for
the cases of plus, minus and negate. In the PR we end up with
a SImode plus, supported by the target but emulated and in this
context fail to verify we are dealing with exactly word_mode.
PR tree-optimization/109672
* tree-vect-stmts.cc (vectorizable_operation): For plus,
minus and negate always check the vector mode is word mode.
-rw-r--r-- | gcc/tree-vect-stmts.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index c71e287..3ad6a7d 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -6384,29 +6384,26 @@ vectorizable_operation (vec_info *vinfo, } bool using_emulated_vectors_p = vect_emulated_vector_p (vectype); - if (!target_support_p) + if (!target_support_p || using_emulated_vectors_p) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "op not supported by target.\n"); + "op not supported by target.\n"); /* Check only during analysis. */ - if (maybe_ne (GET_MODE_SIZE (vec_mode), UNITS_PER_WORD) + if (((code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR) + && maybe_ne (GET_MODE_SIZE (vec_mode), UNITS_PER_WORD)) || (!vec_stmt && !vect_can_vectorize_without_simd_p (code))) - return false; + { + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, "using word mode not possible.\n"); + return false; + } if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "proceeding using word mode.\n"); using_emulated_vectors_p = true; } - if (using_emulated_vectors_p - && !vect_can_vectorize_without_simd_p (code)) - { - if (dump_enabled_p ()) - dump_printf (MSG_NOTE, "using word mode not possible.\n"); - return false; - } - int reduc_idx = STMT_VINFO_REDUC_IDX (stmt_info); vec_loop_masks *masks = (loop_vinfo ? &LOOP_VINFO_MASKS (loop_vinfo) : NULL); internal_fn cond_fn = get_conditional_internal_fn (code); |