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] vectorization with unknown loop bound



On May 17, 2004, at 12:07 PM, Zdenek Dvorak wrote:


Hello,

+   /* If the loop has symbolic number of iterations 'n'
+      (i.e. it's not a compile time constant),
+      then an epilog loop need to be created. We therefore duplicate
+      the initial loop. The original loop will be vectorized, and
will compute
+      (n/VF) iterations. The second copy will remain serial and
compute
+      the remaining (n%VF) iterations. (VF is the vectorization
factor).  */

Any reason for not using nested loops approach here? e.g.


	for (i=0; i<N; i = i + VF)
		for (j=i; j < i + VF && j < N; j++)
			...

I am just curious.

1) You need to test one more condition per iteration of the inner
cycle.
2) And you still cannot vectorize it (unless I miss something important).

If we can fill empty slots in last vector iteration then inner loop can be vectorized. Current approach is reasonable.

--
Devang


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