[PATCH, rs6000] Generate LE code for vec_lvsl and vec_lvsr that is compatible with BE code

Segher Boessenkool segher@kernel.crashing.org
Tue Sep 30 16:04:00 GMT 2014

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 :-(

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


More information about the Gcc-patches mailing list