questions about MOVB/MOVBS/MOVBU of arm

103 views
Skip to first unread message

Ben Shi

unread,
Jun 13, 2017, 5:45:24 AM6/13/17
to golan...@googlegroups.com
1. MOVB R3, R4 is assembled the same code to MOVW R3, R4, why?

2. What is difference between MOVBU and MOVB


Ben Shi

Russ Cox

unread,
Jun 13, 2017, 9:49:09 AM6/13/17
to Ben Shi, golang-dev
On Tue, Jun 13, 2017 at 5:44 AM, Ben Shi <power...@163.com> wrote:
1. MOVB R3, R4 is assembled the same code to MOVW R3, R4, why?

Because there are no byte registers on ARM, so if both args are registers it's fine to move the whole word.
 
2. What is difference between MOVBU and MOVB

The sign-extension behavior when reading from memory into a register: MOVBU zero-extends (treats the byte as unsigned) into the full-width register, while MOVB sign-extends (treats the byte as signed).

Russ

Ben Shi

unread,
Jun 13, 2017, 10:08:34 AM6/13/17
to Russ Cox, golang-dev
There are thrree MOVB:

MOVB MOVBS MOVBU,

if MOVB imply sign extention
what is the difference between MOVB and MOVBS?

Ben Shi

cherry

unread,
Jun 13, 2017, 10:11:52 AM6/13/17
to Ben Shi, Russ Cox, golang-dev
It looks like MOVB does a sign extension for load (you have to extend one way or the other), but not for register move; MOVBS does a sign extension for both load and register move.


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Shi

unread,
Jun 13, 2017, 10:28:57 AM6/13/17
to cherry, Russ Cox, golang-dev
Shall we delete the movb reg, reg 

and movh reg, reg

They are quite confusing.

Ben Shi

cherry

unread,
Jun 13, 2017, 10:39:15 AM6/13/17
to Ben Shi, Russ Cox, golang-dev
No, don't delete instructions. It may break user code.

They are less confusing when you think it as "move a byte, I don't care what the high bits are"...

Reply all
Reply to author
Forward
0 new messages