AnsweredAssumed Answered

PowerPC - sth and sthu opcodes

Question asked by Ross Myers on Jan 22, 2015
Latest reply on Jan 23, 2015 by Lukas Zadrapa

Hi All,

 

I'm just trying to get a clear understanding of the store and store with update commands, the store with update don't seem to be working for me as I thought they would.

When I store a byte, word or long word with the store and update command shouldn't the register that contains the store address then automatically increase by the size of the data stored?

 

Eg....lets assume I set up an address in r9 as 0x60010000

sthu  r5,0(r9) = Store word in r5 to 0x60010000, and automatically increment (update) r9 by 2 as we stored a word (so r9 now = 0x60010002)

stbu  r5,0(r9) = Store byte in r5 to 0x60010000, and automatically increment (update) r9 by 1 as we stored a byte (so r9 now = 0x60010003)

 

Is that correct on how those commands works?

 

Currently I am manually adding to the address in r9 after a stb or sth like so:

sth  r5,0(r9) = Store word in r5 to 0x60010000

addi  r9,r9,2 = increment (update) r9 address by 2 as we stored a word (so r9 = 0x60010002)

 

Obviously that isn't very efficient if I need to store multiple things.

 

Thanks.

Outcomes