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]

Re: [lno] [patch] vectorizer update - support constants.


Dorit Naishlos <DORIT@il.ibm.com> writes:

> * Support for vectorization of constants (e.g, computations of the form
> a[i]=5).

I've tried this on Alpha, with setting NITS_PER_SIMD_WORD to 8. First,
it looks like iteration count recognition is off by one:

short a[128];
void f() {
    int i;
    for (i = 0; i < 128; i++)
        a[i] = 0;
}

vectorization_factor = 4, niters = 127
loop bound unknown or doesn't divide by 4

I cheated and used 129. Then vectorization worked, but the code was
not quite optimal. In the unvectorized version, I get:

   8:   03 04 ff 47     clr     t2
   c:   00 00 5d a4     ldq     t1,0(gp)
                        c: ELF_LITERAL  a
  10:   03 30 60 40     addl    t2,0x1,t2
  14:   00 00 e2 37     stw     zero,0(t1)
  18:   02 00 42 20     lda     t1,2(t1)
  1c:   a1 fd 6f 40     cmple   t2,0x7f,t0
  20:   fb ff 3f f4     bne     t0,10 <f+0x10>

i.e. the IV is not being used for address calculation, however in the
vectorized version

   8:   04 04 ff 47     clr     t3
   c:   03 04 ff 47     clr     t2
  10:   00 00 bd a4     ldq     t4,0(gp)
                        10: ELF_LITERAL a
  14:   00 00 fe 2f     unop
  18:   1f 04 ff 47     nop
  1c:   00 00 fe 2f     unop
  20:   46 16 80 40     s8addq  t3,0,t5
  24:   a2 f7 63 40     cmpule  t2,0x1f,t1
  28:   04 30 80 40     addl    t3,0x1,t3
  2c:   03 30 60 40     addl    t2,0x1,t2
  30:   20 f6 c1 48     zapnot  t5,0xf,v0
  34:   01 04 05 40     addq    v0,t4,t0
  38:   00 00 e1 b7     stq     zero,0(t0)
  3c:   f8 ff 5f f4     bne     t1,20 <f+0x20>

it is (even duplicated), which is less efficient. Is this a know
problem?

-- 
	Falk


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