From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X75wF-0003VK-2w for qemu-devel@nongnu.org; Tue, 15 Jul 2014 12:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X75w6-0003le-17 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 12:50:47 -0400 Received: from mail-ie0-x229.google.com ([2607:f8b0:4001:c03::229]:45490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X75w5-0003lI-O4 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 12:50:37 -0400 Received: by mail-ie0-f169.google.com with SMTP id tp5so4783904ieb.0 for ; Tue, 15 Jul 2014 09:50:37 -0700 (PDT) Sender: Richard Henderson Message-ID: <53C55BD9.4070208@twiddle.net> Date: Tue, 15 Jul 2014 09:50:33 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1405359671-25985-1-git-send-email-kbastian@mail.uni-paderborn.de> <1405359671-25985-16-git-send-email-kbastian@mail.uni-paderborn.de> In-Reply-To: <1405359671-25985-16-git-send-email-kbastian@mail.uni-paderborn.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 15/15] target-tricore: Add instructions of SR opcode format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bastian Koppelmann , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org On 07/14/2014 10:41 AM, Bastian Koppelmann wrote: > +static bool cdc_zero(target_ulong *psw) > +{ > + int cdc = *psw & MASK_PSW_CDC; > + /* Returns TRUE if PSW.CDC.COUNT == 0 or if PSW.CDC == > + 7'b1111111, otherwise returns FALSE. */ > + if (cdc == 0x7f) { > + return true; > + } > + /* find CDC.COUNT */ > + if (((1 << (6 - clo32(*psw & MASK_PSW_CDC))) - 1) == 0) { > + return true; > + } > + > + return false; > +} You've misunderstood me wrt clo. As written here, it'll always return 0, since the value you're passing is zero-extended to 32 bits. Something like int lo = clo32((*psw & MASK_PSW_CDC) << (32 - 7)); int mask = (1u << (7 - lo)) - 1; int count = *psw & mask; return count == 0; > +static void gen_saturate(TCGv ret, TCGv arg, int32_t up, int32_t low) > +{ > + TCGv sat_neg = tcg_const_i32(low); > + TCGv temp = tcg_const_i32(up); > + > + /* sat_neg = (arg < low ) ? low : arg; */ > + tcg_gen_movcond_tl(TCG_COND_LT, sat_neg, arg, sat_neg, arg, sat_neg); > + > + /* ret = (sat_neg > up ) ? up : sat_neg; */ > + tcg_gen_movcond_tl(TCG_COND_GT, ret, sat_neg, temp, temp, sat_neg); > + > + tcg_temp_free(sat_neg); Forgot to free temp. > + case OPC2_16_SR_RSUB: > + tcg_gen_subfi_tl(cpu_gpr_d[r1], 0, cpu_gpr_d[r1]); > + break; tcg_gen_neg_tl. r~