[patch, vectorizer] Support double type conversion in vectorizer

Dorit Nuzman DORIT@il.ibm.com
Tue Aug 12 05:49:00 GMT 2008


>
> Hi,
>
> This patch enables vectorization of double type conversions, like
> conversion from char to int through short. This is done by first
unpacking
> char operands into short operands and then unpacking them into int.
Packing
> is done in similar way.
>
> Bootstrapped with vectorization enabled on ppc-linux and x86-linux.
Tested
> on vectorization tests on ppc-linux and fully tested on x86-linux.
>
> O.K. for mainline?
>

ok
(it would be nice if at some point the transformation parts of the patch
would be outlined to a separate routine and be generalized to support
conversions that require more than 2 intermediate steps (e.g. 8bit char to
64bit long); I don't mind if this is done separately).


A minor comment on naming:

> @@ -2136,12 +2137,17 @@ vect_is_simple_use (tree operand, loop_v
...
> +   - DOUBLE_OP determines if the operation is a double cast, like
> +   char->short->int
> +   - INTERM_TYPE is the intermediate type required to perform the
> +   widening operation (short in the above example)  */

maybe you can consider getting rid of the boolean "double_op" and use
"interm_type" as an indication instead? or change the name "double_op" to
something better ("multi-step-cvt" maybe?)

thanks,
dorit

> Thanks,
> Ira
>
> ChangeLog:
>
>       * tree-vectorizer.c: Depend on langhooks.h.
>       (supportable_widening_operation): Add two arguments. Support double
>       type conversions.
>       (supportable_narrowing_operation): Likewise.
>       * tree-vectorizer.h (supportable_widening_operation): Add two
> arguments.
>       (supportable_narrowing_operation): Likewise.
>       * tree-vect-patterns.c (vect_recog_widen_mult_pattern) : Call
>       supportable_widening_operation with correct arguments.
>       * tree-vect-transform.c (vectorizable_conversion): Likewise.
>       (vectorizable_type_demotion): Support double type conversions.
>       (vectorizable_type_promotion): Likewise.
>       * Makefile.in (tree-vectorizer.o): Depend on langhooks.h.
>
> testsuite/ChangeLog:
>
>       * gcc.dg/vect/vect-multitypes-12.c: New.
>       * gcc.dg/vect/vect-multitypes-13.c,
gcc.dg/vect/vect-multitypes-14.c,
>       gcc.dg/vect/vect-multitypes-15.c : Likewise.
>             * gcc.dg/vect/vect-reduc-dot-u8a.c: Avoid vectorization of
the
> init loop.
>       * gcc.dg/vect/vect-72.c, gcc.dg/vect/vect-strided-store-a-u8-i2.c:
> Likewise.
>       * gcc.dg/vect/vect-reduc-dot-u8b.c: Avoid vectorization of the init
> loop.
>       Should be vectorizable on targets that support vector unpack.
>       * gcc.dg/vect/vect-widen-mult-u8.c,
> gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c,.
>       gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: Likewise.
>       * gcc.dg/vect/vect-35.c: Should be vectorizable on targets that
> support
>       vector pack. Avoid vectorization of the init loop.
>       * gcc.dg/vect/vect-reduc-pattern-1b.c: Should be vectorizable on
> targets that
>       support vector unpack.
>       * gcc.dg/vect/vect-reduc-pattern-2b.c,
> gcc.dg/vect/vect-reduc-dot-s8c.c,
>       gcc.dg/vect/vect-112.c: Likewise.
>
> (See attached file: double-cvt.txt)[attachment "double-cvt.txt"
> deleted by Dorit Nuzman/Haifa/IBM]



More information about the Gcc-patches mailing list