I'm having a hard time understanding what this command does. I'm guessing it means mov halfword signed into a register, but i'm not sure. Any help would be appreciated!
-
2Next time consult a [reference](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0068b/Chdehgih.html). – Jester Mar 16 '14 at 23:42
-
possible duplicate of [Condition bits in SWI (ARM Instruction)](http://stackoverflow.com/questions/19804734/condition-bits-in-swi-arm-instruction) – artless noise Mar 17 '14 at 14:48
2 Answers
I would assume it's a normal move that only occurs if the current condition codes indicate "higher or same" (unsigned >= from previous compare or subtract).

- 27,407
- 3
- 36
- 61
-
Indeed. The canonical mnemonic is `CS` (carry set), but `HS` is a recognised synonym (as is `LO` for `CC`). – Notlikethat Mar 16 '14 at 23:39
This does not have anything to do with halfword or signed. The ARM info center is always a good place to start if your confused, rather than guessing. Anyway, to answer your question, what this command or mnemonic does is it looks in the CSPR (Current Program Status Register), and goes off of the value stored in there. Now this could be the result of an earlier call like cmp r0, r1
. Say that this was the case, and cmp r0, r1
was called before the code movhs
was called. Now, the status of the cmp
call is stored in the CPSR, and when a conditional such as hs
or cs
is added on as in the case with movhs
, what this means is that this statement will only execute if the result in the CPSR is higher or same, i.e., in pseudocode, if (r1 >= r0){execute the mov command}
.

- 2,945
- 34
- 47