Hi,

The attached patch
1. enables vectorization of BAND, BXOR and SHL operations as well as adds 
support for expanding vectorized shift-left operation.
2. fixes a bug in vectorizing expressions with negative coefficient. An example 
program is:
  int a[];
  double b[], x;
  void foo (void) {
      int i;
      for (i = 0; i < 1000; i++)
          b[i] += a[1000-i] * x;
  }

  Note that for "(double)a[1000-i]":
    - the coefficient of the loop index is -1 (so, still unit-strided),
    - and sizeof(a[*]) == 4

  There are only *TWO* elements encapsulated in a single vector. However, 
current SIMD implementation takes for granted there
  are four elements involved. On the other hand, since the coefficient is 
negative, the elements of vector need to be reversed.
  There was no OPCODE capable of reversing two 4-byte elements, hence 
V8I4V8I4SHUFFLE is introduced.

  The wrong vectorized WHIRL of the expression was:
      1          U8LDA 0 <1,52,a> T<57,anon_ptr.,8>
      2          U4INTCONST 0 (0x0)
      3           I4INTCONST 997 (0x3e5) /* wrong starting addr */
      4           I4I4LDID 49 <1,4,.preg_I4> T<4,.predef_I4,4> # i
      5          I4SUB
      6         U8ARRAY 1 4
      7        V8I4V8I4ILOAD 0 T<4,.predef_I4,4> T<58,anon_ptr.,8>
      8       V16I4V16I4SHUFFLE 0  /* wrong shuffle */
      9      V16F8V8I4CVT

  with the fix it is:
      1          U8LDA 0 <1,52,a> T<57,anon_ptr.,8>
      2          U4INTCONST 0 (0x0)
      3           I4INTCONST 999 (0x3e7)
      4           I4I4LDID 49 <1,4,.preg_I4> T<4,.predef_I4,4> # i
      5          I4SUB
      6         U8ARRAY 1 4
      7        V8I4V8I4ILOAD 0 T<4,.predef_I4,4> T<58,anon_ptr.,8>
      8       V8I4V8I4SHUFFLE 0
      9      V16F8V8I4CVT

Can a gatekeeper please review this patch?
Thanks,
Pallavi

Attachment: vectorizer.p
Description: vectorizer.p

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to