SPECIAL3 011111 |
0 00000 |
rt |
rd |
DSBH 00010 |
DBSHFL 100100 |
6 |
5 |
5 |
5 |
5 |
6 |
DSBH rd, rt |
MIPS64 Release 2 |
Doubleword Swap Bytes Within Halfwords |
Doubleword Swap Bytes Within Halfwords
To swap the bytes within each halfword of GPR rt and store the value into GPR rd.
GPR[rd] = SwapBytesWithinHalfwords(GPR[rt])
Within each halfword of GPR rt the bytes are swapped and stored in GPR rd.
In implementations Release 1 of the architecture, this instruction resulted in a Reserved Instruction exception.
GPR[rd] = GPR[t]55.48 || GPR[t]63..56 || GPR[t]39..32 || GPR[t]47..40 || GPR[t]23..16 || GPR[t]31..24 || GPR[t]7..0 || GPR[t]15..8
Reserved Instruction
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 */