Why does MIPS have instructions (load byte unsigned) and (load byte), but only (stored byte)?

There is only a storage byte instruction, so I don’t understand why there are both load bytes and unsigned load bytes ...

I tried to find it, but did not find anything useful.

+4
source share
1 answer

MIPS registers are 32 bits wide. When you load one 8-bit byte into one of these registers from memory, you must decide whether to sign it or not. Therefore, two load instructions. There is no such ambiguity during storage.

Download example:

.data variable: .byte 0x80 .text lb $t0, variable lbu $t1, variable 

After executing this code, t0 will be 0xffffff80 (-128), and t1 will be 0x00000080 (128).

+9
source

Source: https://habr.com/ru/post/1485150/


All Articles