	.text
	.global __eti_atomic_test_and_set
__eti_atomic_test_and_set:	

	/* NOTE: the extra nops here are so there are no stray
         *       load/store operations outstanding when we
	 *       execute the load.  Then it's OK to clear
	 *       the mstat 'valid' bit in the kernel code. -- KJH */
;
;

	.global __eti_atomic_test_and_set_start
__eti_atomic_test_and_set_start:	
; 
	.i0              sld.32         cl0:r61  r32  6@(0/4)
	.f0               mv.32             r60  16@(1)
	.i1                mnop             4;
	
	.f0             ceq.u32         all:p15  r61  zero
	.i1                mnop             1;
	
	.i0 ( p15)       sst.32         cl0:r60  r32  6@(0/4)
	.i1                mnop             4 ; 

	.global __eti_atomic_test_and_set_end
__eti_atomic_test_and_set_end:	
	.i0                 bra             r63 ;
	.f0               mv.32             r32  r61 ;
;
	.end
	