[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] CAS in FC0

Oh sorry i didn't read well you email :

"if r4==0 store_locked [r1],r3" is in fact a single instrustion as does "if
r4==0 jump r0,r63" ?

Is that so, okay what I wrote can be shorter :

r1 : pointer, r2 : requested value, r3 : new value

move r2,r4
move r1,r6
load_tagged [r1],r2
xor r2,r4,r1
if r1 == 0 store_tagged [r6],r3,r1
jump r0,r63

To push in a FIFO list :

move r2,r3 // our node address to push
loopentry r5
load_tagged [r1],r2       // read top
store r2,[r3]                    // node->link = top
if r0 == 0 store_tagged r3,[r1],r4 // top = node
if r4 == 0 jump r0,r63             // return to caller if ok
jump r0,r5

To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/