From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCZBP-0001iy-Oy for qemu-devel@nongnu.org; Tue, 27 Mar 2012 12:23:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCZBO-0006on-31 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 12:23:43 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:52906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCZBN-0006oT-S2 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 12:23:42 -0400 Received: by ghrr14 with SMTP id r14so118108ghr.4 for ; Tue, 27 Mar 2012 09:23:40 -0700 (PDT) Sender: Richard Henderson Message-ID: <4F71E989.9080907@twiddle.net> Date: Tue, 27 Mar 2012 09:23:37 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1332840290-24553-1-git-send-email-proljc@gmail.com> <1332840290-24553-9-git-send-email-proljc@gmail.com> In-Reply-To: <1332840290-24553-9-git-send-email-proljc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 08/12] Add helper functions for MIPS DSP Bit/Manipulation instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jia Liu Cc: qemu-devel@nongnu.org, aurelien@aurel32.net On 03/27/12 02:24, Jia Liu wrote: > +uint32_t helper_bitrev(uint32_t rt) > +{ > + int32_t temp; > + uint32_t rd; > + > + temp = rt & MIPSDSP_LO; > + rd = temp; > + > + return rd; > +} Forgot to actually reverse the bits. > +uint32_t helper_repl_qb(uint32_t imm) ... > +uint32_t helper_repl_ph(uint32_t imm) Should not be helpers. The full 32-bit immediate can be computed directly in the translator. > +void helper_insv(int reg_rt, uint32_t rs, uint32_t rt) > +{ > + uint32_t pos, size, msb, lsb, rs_f, rt_f; > + uint32_t temp, temprs, temprt; > + target_ulong dspc; > + > + dspc = env->active_tc.DSPControl; > + pos = dspc & 0x1F; > + size = (dspc >> 7) & 0x1F; > + msb = pos + size - 1; > + lsb = pos; > + > + if (lsb > msb) > + return; > + > + rs_f = (((int32_t)0x01 << (msb - lsb + 1 + 1)) - 1) << lsb; > + rt_f = rs_f ^ 0xFFFFFFFF; > + temprs = rs & rs_f; > + temprt = rt & rt_f; > + temp = temprs | temprt; > + env->active_tc.gpr[reg_rt] = temp; > +} Err... why does this modify the env directly, rather than return a value? "return rt" would seem to be the correct way to leave the value of reg_rt unchanged... r~