-
- Downloads
middle-end: lower COND_EXPR into gimple form in vect_recog_bool_pattern
Currently the vectorizer cheats when lowering COND_EXPR during bool recog. In the cases where the conditonal is loop invariant or non-boolean it instead converts the operation back into GENERIC and hides much of the operation from the analysis part of the vectorizer. i.e. a ? b : c is transformed into: a != 0 ? b : c however by doing so we can't perform any optimization on the mask as they aren't explicit until quite late during codegen. To fix this this patch lowers booleans earlier and so ensures that we are always in GIMPLE. For when the value is a loop invariant boolean we have to generate an additional conversion from bool to the integer mask form. This is done by creating a loop invariant a ? -1 : 0 with the target mask precision and then doing a normal != 0 comparison on that. To support this the patch also adds the ability to during pattern matching create a loop invariant pattern that won't be seen by the vectorizer and will instead me materialized inside the loop preheader in the case of loops, or in the case of BB vectorization it materializes it in the first BB in the region. gcc/ChangeLog: * tree-vect-patterns.cc (append_inv_pattern_def_seq): New. (vect_recog_bool_pattern): Lower COND_EXPRs. * tree-vect-slp.cc (vect_slp_region): Materialize loop invariant statements. * tree-vect-loop.cc (vect_transform_loop): Likewise. * tree-vect-stmts.cc (vectorizable_comparison_1): Remove VECT_SCALAR_BOOLEAN_TYPE_P handling for vectype. * tree-vectorizer.cc (vec_info::vec_info): Initialize inv_pattern_def_seq. * tree-vectorizer.h (LOOP_VINFO_INV_PATTERN_DEF_SEQ): New. (class vec_info): Add inv_pattern_def_seq. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-conditional_store_1.c: New test. * gcc.dg/vect/vect-conditional_store_5.c: New test. * gcc.dg/vect/vect-conditional_store_6.c: New test.
Showing
- gcc/testsuite/gcc.dg/vect/bb-slp-conditional_store_1.c 15 additions, 0 deletionsgcc/testsuite/gcc.dg/vect/bb-slp-conditional_store_1.c
- gcc/testsuite/gcc.dg/vect/vect-conditional_store_5.c 28 additions, 0 deletionsgcc/testsuite/gcc.dg/vect/vect-conditional_store_5.c
- gcc/testsuite/gcc.dg/vect/vect-conditional_store_6.c 24 additions, 0 deletionsgcc/testsuite/gcc.dg/vect/vect-conditional_store_6.c
- gcc/tree-vect-loop.cc 12 additions, 0 deletionsgcc/tree-vect-loop.cc
- gcc/tree-vect-patterns.cc 36 additions, 3 deletionsgcc/tree-vect-patterns.cc
- gcc/tree-vect-slp.cc 14 additions, 0 deletionsgcc/tree-vect-slp.cc
- gcc/tree-vect-stmts.cc 1 addition, 5 deletionsgcc/tree-vect-stmts.cc
- gcc/tree-vectorizer.cc 2 additions, 1 deletiongcc/tree-vectorizer.cc
- gcc/tree-vectorizer.h 7 additions, 0 deletionsgcc/tree-vectorizer.h
Loading
Please register or sign in to comment