From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZBBN-0006iQ-9o for qemu-devel@nongnu.org; Tue, 08 Sep 2015 01:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZBBK-0002RE-51 for qemu-devel@nongnu.org; Tue, 08 Sep 2015 01:11:01 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZBBJ-00026I-PC for qemu-devel@nongnu.org; Tue, 08 Sep 2015 01:10:58 -0400 Received: by pacfv12 with SMTP id fv12so116161544pac.2 for ; Mon, 07 Sep 2015 22:09:49 -0700 (PDT) Sender: Richard Henderson References: <1441216660-8717-1-git-send-email-rth@twiddle.net> <1441216660-8717-3-git-send-email-rth@twiddle.net> From: Richard Henderson Message-ID: <55EE6D9A.5080601@twiddle.net> Date: Mon, 7 Sep 2015 22:09:46 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 02/11] target-arm: Introduce DisasCompare List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers On 09/07/2015 10:09 AM, Peter Maydell wrote: > On 2 September 2015 at 18:57, Richard Henderson wrote: >> + case 9: /* ls: !C || Z -> !(C && !Z) */ >> + cond = TCG_COND_NE; >> + value = tcg_temp_new_i32(); >> + global = false; >> + tcg_gen_neg_i32(value, cpu_CF); >> + tcg_gen_and_i32(value, value, cpu_ZF); >> break; > > The comment says hi is C && !Z, but the code > doesn't seem to line up with that. At least part > of that is presumably because we store ZF inverted, > but why are we negating CF here? We're computing CF ? -1 : 0. ANDing that with !Z (aka cpu_ZF) gets us C & !Z. >> case 12: /* gt: !Z && N == V */ >> case 13: /* le: Z || N != V */ >> + cond = TCG_COND_NE; >> + value = tcg_temp_new_i32(); >> + global = false; >> + tcg_gen_xor_i32(value, cpu_VF, cpu_NF); >> + tcg_gen_sari_i32(value, value, 31); >> + tcg_gen_andc_i32(value, cpu_ZF, value); > > I think this is correct, but it could use some commentary > to explain what it's doing. Fair enough. r~