[patch] [4.2 projects] vectorize type conversions - 4/6

Dorit Nuzman DORIT@il.ibm.com
Sun Feb 12 13:42:00 GMT 2006


Support vectorization in the presence of data-types of different sizes in
the loop, when the computations on the different data-types are independent
(i.e. no type conversions supported yet).

This part adds support for vectorization of reductions in the presence of
multiple-types.

As explained before, the changes to the vector transformation routine
('vectorizable_reduction' in this patch) basically consist of adding a loop
around the original vector-stmt-creation code (each iteration creates one
vector stmt), and doing some bookkeeping ("chaining" of the vector-stmts)
between iterations of the loop.

One additional bit that comes up with respect to reduction is how the
multiple accumulators that we create are combined together. Say we
vectorize a summation of ints in a loop that also operates on chars, and
the VS is 16 bytes. We'll need to generate 4 vector stmts (in each
iteration) in this case.
One option is to have each of the 4 vector stmts feed the next (i.e., use
one accumulator):
loop:
      vd = phi (init, vd)
      va = vd + vw
      vb = va + vx
      vc = vb + vy
      vd = vc + vz

Another option is to use four accumulators, and combine them together at
the loop epilog:
loop:
      va = phi (init, va)
      vb = phi (init, vb)
      vc = phi (init, vc)
      vd = phi (init, vd)
      va = va + vw
      vb = vb + vx
      vc = vc + vy
      vd = vd + vz
epilog:
      vd = (va + vb + vc + vd)

We currently generate the first option (single accumulator). The thought is
in the future to generate the other scheme (multiple accumulators) if the
flag -fvariable-expansion-in-unroller is specified.

Bootstrapped with vectorization enabled and tested on the vectorizer
testcases on powerpc-linux.
Also bootstrapped tested on the vectorizer testcases on i686-pc-linux-gnu.

ok for mainline?

thanks,
dorit

:ADDPATCH SSA (vectorizer):

        * tree-vect-transform.c (vectorizable_reduction): Support in the
        presence of multiple datatypes.
        (vect_transform_stmt): Removed redundant code.


        * gcc.dg/vect/vect-multitypes-7.c: New test.


(See attached file: multitypes.patch4.txt)
(See attached file: vect-multitypes-7.c)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: multitypes.patch4.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060212/dc1e8f00/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vect-multitypes-7.c
Type: application/octet-stream
Size: 873 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060212/dc1e8f00/attachment.obj>


More information about the Gcc-patches mailing list