[patch] convert.c: Fix PR tree-optimization/25125. (Take 2)

Dorit Naishlos DORIT@il.ibm.com
Wed Dec 21 16:03:00 GMT 2005


Hi,

>
> One drawback of this approach is that some vectorization testcases
> rely on this transformation.  gcc.dg/vect/vect-35.c, for example, has
> a statement like so:
>
>   s.a[i] = s.b[i] + 1;
>
> Without this patch, convert_to_integer narrows the type of the
> addition to char, which is the type of s.b[i].  However, with this
> patch, convert_to_integer no longer changes the type of the addition,
> and the vectorizer fails to vectorize this case.  For now, I XFAILed
> those affected vectorizer testcases.
>

One comment is that this way these testcases don't test anymore whatever
they were originally introduced to test. So, in order to also have a
version that maintains the original behavior, lets also compile these
specific tests with -fwrapv. (I'd rather not enable -fwrapv for all
vectorizer testcases, cause I'd prefer if the testcases generally reflected
the behavior of the vectorizer that users (that wouldn't normally enable
-fwrapv for vectorization) would see). A patch that does this attached
below.

As for the XFAILs - the only way these trivial tests will get vectorized
again (when -fwrapv is not enabled) is by directly vectorizing the casts
using data packing/unpacking (on targets that can support that). We're
actually going to have this capability (vectorization of type-conversions)
in mainline soon, but while it may turn these XFAILs into XPASSes, this
should probably still be considered a regression (cause the tests, even if
vectorized, will be vectorized much less efficiently).

We should probably open a "missed optimization" PR for this. I wonder how
we'd envision solving this PR though (i.e. restoring the ability to
efficiently vectorize these trivial testcases without having to enable
-fwrapv and without resorting to vectorization of type conversions)? I
guess one solution was suggested by Paolo Bonzini
(http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01594.html).

dorit

        * gcc.dg/vect/vect.exp: Add -fwrapv flag when compiling testcases
        prefixed with "wrapv-".
        * gcc.dg/vect/wrapv-vect-7.c: New (previosuly named vect-7.c).
        * gcc.dg/vect/wrapv-vect-35.c: New (previosuly named vect-35.c).
        * gcc.dg/vect/wrapv-vect-reduc-2char.c: New (previosuly named
        vect-reduc-2char.c).
        * gcc.dg/vect/wrapv-vect-reduc-2short.c: New (previosuly named
        vect-reduc-2short.c).

(See attached file: wrapv.patch.txt)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wrapv.patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051221/42d96f47/attachment.txt>


More information about the Gcc-patches mailing list