in reply to Re: interchanging variables the tough way (BENCHMARK)
in thread interchanging variables the tough way
Apologies for non perl post, but perspective can be useful sometimes ;-); Swap r0,r1 using r2 as temporary ; Takes 3 cycles traditional MOV r2, r0 ; r2 <- r0 MOV r0, r1 ; r0 <- r1 MOV r1, r2 ; r1 <- r2 ; Swap r0, r1 with no extra register ; Takes 3 cycles xor EOR r0, r0, r1 ; r0 <- r0 ^ r1 EOR r1, r0, r1 ; r1 <- r0 ^ r1 EOR r0, r0, r1 ; r0 <- r0 ^ r1
|
---|