On 05/31/2013 11:01 AM, Jani Kokkonen wrote: > +static inline void tcg_out_rev(TCGContext *s, int ext, TCGReg rd, TCGReg rm) > +{ > + /* using REV 0x5ac00800 */ > + unsigned int base = ext ? 0xdac00c00 : 0x5ac00800; > + tcg_out32(s, base | rm << 5 | rd); > +} > + > +static inline void tcg_out_rev16(TCGContext *s, int ext, TCGReg rd, TCGReg > rm) > +{ > + /* using REV16 0x5ac00400 */ > + unsigned int base = ext ? 0xdac00400 : 0x5ac00400; > + tcg_out32(s, base | rm << 5 | rd); > +} > + > +static inline void tcg_out_rev32(TCGContext *s, TCGReg rd, TCGReg rm) > +{ > + /* using REV32 0xdac00800 */ > + unsigned int base = 0xdac00800; > + tcg_out32(s, base | rm << 5 | rd); > +}
You don't actually need rev32. > * bswap32_i32/i64 t0, t1 > > 32 bit byte swap on a 32/64 bit value. With a 64 bit value, it assumes that > the four high order bytes are set to zero. The fact that the high order bytes are known to be zero means that you can always use tcg_out_rev with ext=0. case INDEX_op_bswap64_i64: ext = 1; /* FALLTHRU */ case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: tcg_out_rev(s, ext, args[0], args[1]); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev16(s, 0, args[0], args[1]); break; r~