From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCaPe-0005Yf-VD for qemu-devel@nongnu.org; Tue, 27 Mar 2012 13:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCaPd-0003vA-7j for qemu-devel@nongnu.org; Tue, 27 Mar 2012 13:42:30 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:60383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCaPd-0003ul-03 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 13:42:29 -0400 Received: by ggnp2 with SMTP id p2so201178ggn.4 for ; Tue, 27 Mar 2012 10:42:27 -0700 (PDT) Sender: Richard Henderson Message-ID: <4F71FC00.3060700@twiddle.net> Date: Tue, 27 Mar 2012 10:42:24 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1332840290-24553-1-git-send-email-proljc@gmail.com> <1332840290-24553-10-git-send-email-proljc@gmail.com> In-Reply-To: <1332840290-24553-10-git-send-email-proljc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 09/12] Add helper functions for MIPS DSP Compare-Pick 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 cc3 = 0, cc2 = 0, cc1 = 0, cc0 = 0; > + uint32_t flag; ... > + if (rs3 == rt3) > + cc3 = 1; Clearer as "cc3 = (rs3 == rt3);", etc. I begin to wonder if it wouldn't be better to model the DSPControl word as individual variables of their respective fields. That way you don't need to involve ENV so much. E.g. Assume cpu_dspcc is a TCGv_i32 variable containing 4 bits. case CMPGU_COND_QB: gen_helper_cmpdu_cond_qb(cpu_gr[rd], cpu_gr[rs], cpu_gr[rt]); break; case CMPGDU_COND_QB: gen_helper_cmpdu_cond_qb(cpu_dspcc, cpu_gr[rs], cpu_gr[rt]); tcg_gen_mov(cpu_gr[rd], cpu_dspcc); break; No need for two separate helpers. Even if you don't decide to split the field, you probably don't want to duplicate so much code in the helpers file. r~