This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Generate LE code for vec_lvsl and vec_lvsr that is compatible with BE code
- From: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: gcc-patches at gcc dot gnu dot org, dje dot gcc at gmail dot com
- Date: Tue, 30 Sep 2014 11:18:39 -0500
- Subject: Re: [PATCH, rs6000] Generate LE code for vec_lvsl and vec_lvsr that is compatible with BE code
- Authentication-results: sourceware.org; auth=none
- References: <1412029574 dot 2986 dot 42 dot camel at gnopaine> <20140930145024 dot GB29948 at gate dot crashing dot org> <1412090663 dot 2986 dot 50 dot camel at gnopaine> <20140930160444 dot GC29948 at gate dot crashing dot org>
On Tue, 2014-09-30 at 11:04 -0500, Segher Boessenkool wrote:
> On Tue, Sep 30, 2014 at 10:24:23AM -0500, Bill Schmidt wrote:
> > On Tue, 2014-09-30 at 09:50 -0500, Segher Boessenkool wrote:
> > > On Mon, Sep 29, 2014 at 05:26:14PM -0500, Bill Schmidt wrote:
> > > > The method used in this patch is to perform a byte-reversal of the
> > > > result of the lvsl/lvsr. This is accomplished by loading the vector
> > > > char constant {0,1,...,15}, which will appear in the register from left
> > > > to right as {15,...,1,0}. A vperm instruction (which uses BE element
> > > > ordering) is applied to the result of the lvsl/lvsr using the loaded
> > > > constant as the permute control vector.
> > >
> > > It would be nice if you could arrange the generated sequence such that
> > > for the common case where the vec_lvsl feeds a vperm it is results in
> > > just lvsr;vnot machine instructions. Not so easy to do though :-(
> >
> > Yes -- as you note, that only works when feeding a vperm, which is what
> > we expect but generally a lot of work to prove.
>
> I meant generating a sequence that just "falls out" as you want it after
> optimisation. E.g. lvsr;vnot;vand(splat8(31));vperm can have the vand
> absorbed by the vperm. But that splat is nasty when not optimised away :-(
Especially since splat8(31) requires vsub(splat8(15),splat8(-16))...
To get something that is correct with and without feeding a vperm and
actually performs well just ain't happening here...
>
> > Again, this is
> > deprecated usage so it seems not worth spending the effort on this...
>
> There is that yes :-)
>
> > > i++ is the common style.
> >
> > Now that we're being compiled as C++, ++i is the common style there --
>
> The GCC source code didn't magically change to say "++i" everywhere it
> said "i++" before, when we started compiling it with ++C :-P
>
> > is there guidance about this for gcc style these days?
>
> codingconventions.html doesn't say.
>
> grep | wc in rs6000/ shows 317 vs. 86; so a lot of stuff has already
> leaked in (and in gcc/*.c it is 6227 vs. 793). Some days I think the
> world has gone insane :-(
>
> To me "++i" reads as "danger, pre-increment!" Old habits I suppose.
> I'll shut up now.
Heh. I have to go back and forth between C and C++ a lot these days and
find it's best for my sanity to just stick with the preincrement form
now...
Thanks,
Bill
>
>
> Segher
>