From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjRcN-0000C8-50 for qemu-devel@nongnu.org; Mon, 03 Jun 2013 06:04:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjRcD-0005Ib-KU for qemu-devel@nongnu.org; Mon, 03 Jun 2013 06:03:59 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:11102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjRK9-0007gS-1t for qemu-devel@nongnu.org; Mon, 03 Jun 2013 05:45:09 -0400 Message-ID: <51AC6587.7030901@huawei.com> Date: Mon, 3 Jun 2013 11:44:39 +0200 From: Claudio Fontana MIME-Version: 1.0 References: <51A8E339.5000500@huawei.com> <51A8E597.4040608@huawei.com> <51A8F5F4.3060407@twiddle.net> In-Reply-To: <51A8F5F4.3060407@twiddle.net> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement byte swap operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Laurent Desnogues , Peter Maydell , Jani Kokkonen , qemu-devel@nongnu.org On 31.05.2013 21:11, Richard Henderson wrote: > 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~ > ACK.