This is the mail archive of the java@gcc.gnu.org mailing list for the Java 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: Auto-vectorization with gcj


From: Bryce McKinlay <mckinlay@redhat.com>

> >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?

> 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.

Your observation would be correct.
I tried --no-bounds-check option, which changed the messages gcj gave me.
They suggest the next trouble appeared.

% gcj -O2 -fno-bounds-check -msse2 -ftree-vectorize -ftree-vectorizer-verbose=5 -c Test.java

Test.java:7: note: not vectorized: too many BBs in loop.
Test.java:11: note: not vectorized: too many BBs in loop.
Test.java:6: note: vectorized 0 loops in function.

% gcj -v
...
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)

Have Bounds checks which were omitted already divided the loop body
into multiple basic blocks?
Do we conclude that auto-vectorization does not work with the current gcj?

  Kazuyuki Shudo	shudo@computer.org	http://www.shudo.net/


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