SPECIAL3 011111 |
0 00000 |
rt |
rd |
DSHD 00101 |
DBSHFL 100100 |
6 |
5 |
5 |
5 |
5 |
6 |
DSHD rd, rt |
MIPS64 Release 2 |
Doubleword Swap Halfwords Within Doublewords |
Doubleword Swap Halfwords Within Doublewords
To swap the halfwords of GPR rt and store the value into GPR rd.
GPR[rd] = SwapHalfwordsWithinDoublewords(GPR[rt])
The halfwords of GPR rt are swapped and stored in GPR rd.
In implementations of Release 1 of the architecture, this instruction resulted in a Reserved Instruction exception.
GPR[rd] = GPR[rt]15..0 || GPR[rt]31..16 || GPR[rt]47..32 || GPR[rt]63..48
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 */