Skip to contentSkip to conversation

parisc asm questions

parisc-linux Randolph Chung 1 participant 1 message Oct 21, 2000

lore
Share & tools
lore
#0 lore raw

would someone please enlighten me about why this is happening?

i have a simple fetch-add asm loop:

/* arg0 is a pointer to a buffer, %arg1 is the length, %r4 == %arg1>>2 */ $loop:

	ldws,ma		4(%arg0), %r3
	addc		%ret0, %r3, %ret0
	addib,<>	-1, %r4, $loop
	addi		-4, %arg1, %arg1

i notice that the sum returned is sometimes off by a certain amount from what i was expecting. while i was tracing this down, i added a line to the loop so that it's:

$loop:

	add		%r0, %r3, %r3	/* isn't this equivalent to a nop? */
	ldws,ma		4(%arg0), %r3
	addc		%ret0, %r3, %ret0
	addib,<>	-1, %r4, $loop
	addi		-4, %arg1, %arg1

and i get fairly different behavior. I think I'm not understanding how the carry bit gets updated or something. any hints will be much appreciated.

randolph

Signature · 4 lines
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^