What exactly does the lb instruction do?

后端 未结 2 513
时光说笑
时光说笑 2021-01-14 11:40

I have an exam coming up, and one of the practice problems was:

Assume that $t0 contains the value 0x12121212 and $t1<

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 12:27

    The answer would be c) 0xffffff88. The lb instructions sign-extends the byte into a 32-bit value. I.e. the most significant bit (msb) is copied into the upper 24 bits.

    0x88 == 0b10001000, i.e. the msb is 1. So the upper 24 bits will be 0b111111111111111111111111 == 0xffffff.

提交回复
热议问题