This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] RFC - tree vectorizer
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 31 Dec 2003 15:28:50 +0200
- Subject: Re: [tree-ssa] RFC - tree vectorizer
> > How do I force '*ptr' references into
> > the same alias set as 'a[i]' references?
>
> Using unions.
For now what I'm doing is continuing to use the type casting scheme, and
forcing the alias set of the vector reference to be the same as the alias
set of the scalar reference using:
TYPE_ALIAS_SET (TREE_TYPE (vec_var)) = TYPE_ALIAS_SET (TREE_TYPE
(scalar_var));
It seems to solve the problem, but if this is wrong and/or there are better
ways to achieve this functionality I'm open to suggestions. I don't think
I can make use of unions though as this implies I'll have to change the
definition of the scalar reference itself, which I can't always do.
thanks,
dorit
Daniel Berlin
<dberlin@dberlin. To: Dorit Naishlos/Haifa/IBM@IBMIL
org> cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org, Diego Novillo
<dnovillo@redhat.com>, Pop Sébastian <pop@gauvain.u-strasbg.fr>, Devang Patel
26/12/2003 01:50 <dpatel@apple.com>, David Edelsohn <dje@watson.ibm.com>, Geoff Keating
<geoffk@apple.com>
Subject: Re: [tree-ssa] RFC - tree vectorizer
On Fri, 26 Dec 2003, Dorit Naishlos wrote:
>
>
>
>
> Hi,
>
> Here is the first implementation of a basic loop vectorizer, as described
> in http://gcc.gnu.org/projects/tree-ssa/vectorization.html. A real patch
> will follow shortly - this one is relative to an old tree-ssa snapshot
and
> also includes bits from an old version of Sebastian's IV evolution
> analyzer. But I think it's in a shape that allows people to start to take
a
> look and comment (please do!).
>
> A few comments/questions:
> As I described in http://gcc.gnu.org/ml/gcc/2003-12/msg00908.html, memory
> references are vectorized using a pointer to vector type which is used to
> point to the accessed array; e.g., the following scalar code:
> (1a) int a[N] = {0,1,2,3};
> (2a) for (i...) {int x = a[i]; ...} #VUSE a_1
> becomes:
> (1b) int a[N] = {0,1,2,3}
> (2b) v4si *ptr = (v4si *)a;
> (3b) for (i...) {v4si vx = *(ptr + 16 * i); ...}
> Unfortunately, due to the aliasing semantics in gcc, the compiler marks
> reads/writes via 'ptr' as referencing a different alias set than the
> reads/writes via 'a[i]' (because they have different types). Therefore,
> unless I use -fno-strict-aliasing, the resulting code does not run
> correctly (in the example above, the load in (3b) is hoisted before the
> stores that initialize array 'a'...). How do I force '*ptr' references
into
> the same alias set as 'a[i]' references?
Using unions.
THe above violates C aliasing rules (you are casting int * to v4si *),
AFAIK.[attachment "vect_patch" deleted by Dorit Naishlos/Haifa/IBM]
[attachment "tree-vectorizer_h" deleted by Dorit Naishlos/Haifa/IBM]
[attachment "tree-vectorizer_c" deleted by Dorit Naishlos/Haifa/IBM]
[attachment "vec_test_SF_c" deleted by Dorit Naishlos/Haifa/IBM]