test & set ppc assembly (libgcj vs. threads)

David Edelsohn dje at watson.ibm.com
Tue Aug 3 05:02:32 EST 1999


	The PowerPC User's Manuals provide an example in the appendix:

loop:	lwarx	    r5, 0, r3	   # load and reserve
	cmpwi	    r5, 0	   # compare to zero
	bne	    $+12	   # done if not equal
	stwcx.	    r4, 0, r3	   # try to store non-zero
	bne-	    loop	   # loop if lost reservation

r3 = address
r4 = new value
r5 = old value

David

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]





More information about the Linuxppc-dev mailing list