| |||

Home > The Cortex-M7 Instruction Set > Bit field instructions > SXT and UXT |

Sign extend and Zero extend.

`SXT`

{`extend`

}`cond`

,`Rd`

{, ROR #`Rn`

}`n`

`UXT`

{`extend`

}`cond`

,`Rd`

{, ROR #`Rn`

}`n`

Where:

`extend`

Is one of:

`B`

Extends an 8‑bit value to a 32‑bit value.

`H`

Extends a 16‑bit value to a 32‑bit value.

`cond`

Is an optional condition code. See

*Conditional execution*.`Rd`

Is the destination register.

`Rn`

Is the register holding the value to extend.

`ROR #`

`n`

Is one of:

`ROR #8`

Value from

is rotated right 8 bits.`Rn`

`ROR #16`

Value from

is rotated right 16 bits.`Rn`

`ROR #24`

Value from

is rotated right 24 bits.`Rn`

If

is omitted, no rotation is performed.`ROR #`

`n`

These instructions do the following:

Rotate the value from

right by 0, 8, 16 or 24 bits.`Rn`

Extract bits from the resulting value:

`SXTB`

extracts bits[7:0] and sign extends to 32 bits.`UXTB`

extracts bits[7:0] and zero extends to 32 bits.`SXTH`

extracts bits[15:0] and sign extends to 32 bits.`UXTH`

extracts bits[15:0] and zero extends to 32 bits.