/* src = abcd
efgh */
if (use_mips32r2_instructions) {
tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg); /* ret = cdab
ghef */
} else if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) ==
TCG_BSWAP_OZ) {
tcg_out_opc_imm(s, OPC_ANDI, ret, ret, 0xffff);
/* ret = 0000
ghef */
tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, arg, 8); /* t0 = ssab
cdef */
if (!(flags & TCG_BSWAP_IZ)) { /* t0 = 0000
00ef */
tcg_out_opc_imm(s, OPC_ANDI, TCG_TMP0, TCG_TMP0, 0x00ff);
}
if (flags & TCG_BSWAP_OS) {
tcg_out_opc_sa(s, OPC_SLL, ret, arg, 24); /* ret = gh..
.... */
tcg_out_opc_sa(s, OPC_SRA, ret, ret, 16); /* ret = ssss
gh.. */
} else {
tcg_out_opc_sa(s, OPC_SLL, ret, arg, 8); /* ret = cdef
gh.. */
if (flags & TCG_BSWAP_OZ) { /* ret = 0000
gh.. */
tcg_out_opc_imm(s, OPC_ANDI, ret, ret, 0xff00);
}
}
tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP0); /* OZ: ret = 0000
ghef */
/* OS: ret = ssss
ghef */