
The Cortex-M4 Instruction Set
ARM DUI 0553A
Copyright © 2010 ARM. All rights reserved.
3-67
ID121610
Non-Confidential
3.5.19
UHASX and UHSAX
Unsigned Halving Add and Subtract with Exchange and Unsigned Halving Subtract and Add
with Exchange.
Syntax
op{
cond
} {
Rd
},
Rn
,
Rm
where:
op
Is one of:
UHASX
Add and Subtract with Exchange and Halving.
UHSAX
Subtract and Add with Exchange and Halving.
cond
Is an optional condition code, see
.
Rd
Specifies the destination register.
Rn
,
Rm
Are registers holding the first and second operands.
Operation
The
UHASX
instruction:
1.
Adds the top halfword of the first operand with the bottom halfword of the second
operand.
2.
Shifts the result by one bit to the right causing a divide by two, or halving.
3.
Writes the halfword result of the addition to the top halfword of the destination register.
4.
Subtracts the top halfword of the second operand from the bottom highword of the first
operand.
5.
Shifts the result by one bit to the right causing a divide by two, or halving.
6.
Writes the halfword result of the division in the bottom halfword of the destination
register.
The
UHSAX
instruction:
1.
Subtracts the bottom halfword of the second operand from the top highword of the first
operand.
2.
Shifts the result by one bit to the right causing a divide by two, or halving.
3.
Writes the halfword result of the subtraction in the top halfword of the destination register.
4.
Adds the bottom halfword of the first operand with the top halfword of the second
operand.
5.
Shifts the result by one bit to the right causing a divide by two, or halving.
6.
Writes the halfword result of the addition to the bottom halfword of the destination
register.
Restrictions
Do not use SP and do not use PC
.
Condition flags
These instructions do not affect the condition code flags.