Encoding:

POOL32S

010110

rt

rs

DSBH

0111101100

POOL32Sxf

111100

6

5

5

10

6

Format:

DSBH rt, rs

microMIPS64

Doubleword Swap Bytes Within Halfwords

Purpose:

Doubleword Swap Bytes Within Halfwords

To swap the bytes within each halfword of GPR rs and store the value into GPR rt.

Description:

 GPR[rt] = SwapBytesWithinHalfwords(GPR[rs])

Within each halfword of GPR rs the bytes are swapped and stored in GPR rt.

Restrictions:

In implementations Release 1 of the architecture, this instruction resulted in a Reserved Instruction exception.

Operation:

GPR[rt] = GPR[s]55.48 || GPR[s]63..56 || GPR[s]39..32 || GPR[s]47..40 ||
          GPR[s]23..16 || GPR[s]31..24 || GPR[s]7..0 || GPR[s]15..8

Exceptions:

Reserved Instruction

Programming Notes:

The DSBH and DSHD instructions can be used to convert doubleword data of one endianness to the other endianness.

For example:

ld    t0, 0(a1)           /* Read doubleword value */
dsbh  t0, t0              /* Convert endiannes of the halfwords */
dshd  t0, t0              /* Swap the halfwords within the doublewords */