Encoding:

POOL32S

010110

rt

rs

DSHD

1111101100

POOL32SXf

111100

6

5

5

10

6

Format:

DSHD rt, rs

microMIPS64

Doubleword Swap Halfwords Within Doublewords

Purpose:

Doubleword Swap Halfwords Within Doublewords

To swap the halfwords of GPR rs and store the value into GPR rt.

Description:

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

The halfwords of GPR rs are swapped and stored in GPR rt.

Restrictions:

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

Operation:

GPR[rt] = GPR[rs]15..0 || GPR[rs]31..16 || GPR[rs]47..32 || GPR[rs]63..48

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 */