3.5.7. REV, REV16, and REVSH

Reverse bytes.

Syntax

REV Rd, Rn
REV16 Rd, Rn
REVSH Rd, Rn

where:

Rd

is the destination register.

Rn

is the source register.

Operation

Use these instructions to change endianness of data:

REV

converts 32-bit big-endian data into little-endian data or 32-bit little-endian data into big-endian data.

REV16

converts two packed 16-bit big-endian data into little-endian data or two packed 16-bit little-endian data into big-endian data.

REVSH

converts 16-bit signed big-endian data into 32-bit signed little-endian data or 16-bit signed little-endian data into 32-bit signed big-endian data.

Restrictions

In these instructions, Rd, and Rn must only specify R0-R7.

Condition flags

These instructions do not change the flags.

Examples

    REV    R3, R7  ; Reverse byte order of value in R7 and write it to R3
    REV16  R0, R0  ; Reverse byte order of each 16-bit halfword in R0
    REVSH  R0, R5  ; Reverse signed halfword

Copyright © 2009 ARM Limited. All rights reserved.ARM DUI 0497A
Non-Confidential