This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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)

Attachment: multitypes.patch4.txt
Description: Text document

Attachment: vect-multitypes-7.c
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]