This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57328] Missed optimization: Unable to vectorize Fortran min and max intrinsics
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 May 2013 14:22:10 +0000
- Subject: [Bug tree-optimization/57328] Missed optimization: Unable to vectorize Fortran min and max intrinsics
- Auto-submitted: auto-generated
- References: <bug-57328-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57328
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glisse at gcc dot gnu.org
--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #9)
> The difficulty seems to be with vectorizing an AND or OR of 2 conditions.
> a<b || b unord b leaves control flow around
> a<b | b unord b complains that bit-precision arithmetic is not supported
>
> The second one in particular looks like a limitation in the vectorizer that
> would be nice to lift. I get the same issue with a loop using
> a[i]<0&b[i]<=0, it isn't related to unord in particular.
Interestingly enough, using cond=a[i]<0&b[i]<=0 in a cond_expr fails to
vectorize, but using (double)cond!=0 in the same cond_expr does vectorize (to a
horrible result), thanks to vect_recog_bool_pattern, which is triggered by a
conversion of the result of AND. I assume we want a similar pattern thing
triggered by cond_expr. What pattern should it present to the vectorizer?
Something like c1=(a[i]<0)?-1:0 (for c1, -1 and 0 of an integer type of the
same size as the cond_expr), c2=(b[i]<=0)?-1:0, c=c1&c2, cond_expr(c!=0,...)
maybe, so it looks as close as possible to the desired vectorized form? (we
don't have to use -1 instead of 1 here, sticking to 1 may allow to share more
code with the existing pattern, but then we would want a later pass to change
it)