This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/69848] poor vectorization of a loop from SPEC2006 464.h264ref
- From: "alahay01 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 17 Feb 2016 16:40:24 +0000
- Subject: [Bug tree-optimization/69848] poor vectorization of a loop from SPEC2006 464.h264ref
- Auto-submitted: auto-generated
- References: <bug-69848-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69848
--- Comment #3 from alahay01 at gcc dot gnu.org ---
The standard way of dealing with condition reductions like this is to ignore
the contents of the "if" statement and produce a lot of code to deal with the
general case (it creates two vectors - one full of indexes and one full of
results). In the code, this is where STMT_VINFO_VEC_REDUCTION_TYPE is set to
COND_REDUCTION in tree-vect-loop.c.
We have an optimisation of this for when the code is "if (a[b]) c=b" which
bypasses most of the code produced by the general case. In the code, this is
where STMT_VINFO_VEC_REDUCTION_TYPE is set to INTEGER_INDUC_COND_REDUCTION
tree-vect-loop.c.
I haven't figured out what the generated asm should look like for this issue,
but I think we'll need a further vect_reduction_type case (CONST_COND_REDUCTION
??) which is checked for at the same point as INTEGER_INDUC_COND_REDUCTION
(just after the "If we have a condition reduction, see if we can simplify it
further." comment).