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]

Vectorizer RFC patch


I'm working on a new target which has some suport for (mostly) V2HI
vectors. In particular, I'd like to get gcc to generate dotv2hi patterns
from

int mac(const short *a, const short *b, int sqr, int *sum)
{
 int i;
 int dotp = *sum;

 for (i = 0; i < 150; i++) {
  dotp += b[i] * a[i];
  sqr += b[i] * b[i];
 }

 *sum = dotp;
 return sqr;
}

The problem is that this involves an int value, and the vectorizer gives
up because it obviously can't generate a vector out of SImode ints when
UNITS_PER_SIMD_WORD is 4.

I'm playing with the patch below (based on a 4.5 tree), which allows the
vectorizer to treat scalar types as one-element vectors. It uses some
new inline functions in tree.h rather than direct accesses to TREE_TYPE
and TYPE_VECTOR_SUBPARTS, and makes adjustments to some functions such
as build_vector.

This gives me the code generation I want on this loop. Since I'm not all
that familiar with the vectorizer I thought I'd post the patch here for
comments. Does this look like a reasonable solution, or should I be
looking at something else?


Bernd

Attachment: vect-single.diff
Description: Text document


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