Auto-vectorization with gcj
Bryce McKinlay
mckinlay@redhat.com
Mon May 16 20:38:00 GMT 2005
Andrew Haley wrote:
>Dietmar Lippold writes:
> > I tried to test auto-vectorization with the following java program:
> >
> > public class Test {
> > private static int[] a = new int[256];
> > private static int[] b = new int[256];
> > private static int[] c = new int[256];
> >
> > public static final void main(String[] args) {
> > for (int i = 0; i < 256; i++) {
> > b[i] = i;
> > c[i] = i;
> > }
> > for (int i = 0; i < 256; i++) {
> > a[i] = b[i] + c[i];
> > }
> > }
> > }
> >
> > When I compile it with
> >
> > gcj -msse2 -O2 -ftree-vectorize -ftree-vectorizer-verbose=5 -c Test.java
> >
> > I get the following message:
> >
> > Test.java:9: note: not vectorized: multiple exits.
> > Test.java:14: note: not vectorized: multiple exits.
> > Test.java:7: note: vectorized 0 loops in function.
> >
> > Is it not possible to use auto-vectorization with gcj until now?
>>Not as far as I am aware, no. You may be the first person ever to
>try it.
>>I don't know why the compiler believes the loops have multiple exits.
>
The possibility of throwing an ArrayBoundsException would be considered
an exit. In order to vectorize this loop we first need value range
propagation, so that the array bounds checks can be eliminated.
However, compiling with --no-bounds-check would work around the issue
and should permit the loop to be vectorized.
Bryce
More information about the Java
mailing list