kernel oops due to unaligned access with lswi

Gabriel Paubert paubert at
Mon Nov 17 20:19:59 EST 2003

On Sun, Nov 16, 2003 at 06:31:45PM -0500, David Edelsohn wrote:
> >>>>> Benjamin Herrenschmidt writes:
> Ben> We surely don't want them on G5 at least as they are microcoded
> 	Again, one cannot approach this as black or white.  What about
> optimizing for size?

Using lswi/stswi is fine when optimizing for size, but I think
that using these instructions for the case of an 8 byte
move is wrong in most cases because an additional instruction
is often (but not always) needed to compute the address.

Moving 8 bytes with lswi/stswi:

	la rx,src # compute source address
	lswi 5,rx,8
	la ry, dst# compute destination address
	stswi 5,ry,8

Moving 8 bytes with standard instructions:

	lwz rx,src
	lwz ry,src+4
	stw rx,dst
	stw ry,dst+4

IMHO, lswi/stswi should only be used when the move
would be split into 3 or more l[bhw]z/st[bhw] pairs
(i.e., for sizes of 7 or 9 and up).


** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list