From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPOLV-0007xV-7K for qemu-devel@nongnu.org; Wed, 12 Aug 2015 01:13:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPOLQ-0006LS-3n for qemu-devel@nongnu.org; Wed, 12 Aug 2015 01:13:01 -0400 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:35655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPOLP-0006LC-Ui for qemu-devel@nongnu.org; Wed, 12 Aug 2015 01:12:56 -0400 Received: by qgj62 with SMTP id 62so4237385qgj.2 for ; Tue, 11 Aug 2015 22:12:55 -0700 (PDT) Sender: Richard Henderson References: <1439151229-27747-1-git-send-email-laurent@vivier.eu> <1439151229-27747-9-git-send-email-laurent@vivier.eu> From: Richard Henderson Message-ID: <55CAD5D2.5050200@twiddle.net> Date: Tue, 11 Aug 2015 22:12:50 -0700 MIME-Version: 1.0 In-Reply-To: <1439151229-27747-9-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.5 08/30] m68k: update CPU flags management List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, Andreas Schwab , gerg@uclinux.org On 08/09/2015 01:13 PM, Laurent Vivier wrote: > @@ -798,9 +796,9 @@ void HELPER(mac_set_flags)(CPUM68KState *env, uint32_t acc) > } > } > > -void HELPER(flush_flags)(CPUM68KState *env, uint32_t cc_op) > +uint32_t HELPER(flush_flags)(CPUM68KState *env, uint32_t op) > { > - cpu_m68k_flush_flags(env, cc_op); > + return cpu_m68k_flush_flags(env, op); > } Since this function no longer modifies ENV, it probably deserves a better name than "flush_flags". FWIW cc_compute_all isn't a bad name, if you're copying i386 anyway... > -DEF_HELPER_2(flush_flags, void, env, i32) > +DEF_HELPER_2(flush_flags, i32, env, i32) Modify to use DEF_HELPER_FLAGS while you're at it. At the moment it reads some globals, but doesn't write any, or have any other side effects. > static inline void gen_flush_flags(DisasContext *s) > { > if (s->cc_op == CC_OP_FLAGS) > return; > - gen_flush_cc_op(s); > - gen_helper_flush_flags(cpu_env, QREG_CC_OP); > - s->cc_op = CC_OP_FLAGS; > + if (s->cc_op == CC_OP_DYNAMIC) { > + gen_helper_flush_flags(QREG_CC_DEST, cpu_env, QREG_CC_OP); > + } else { > + gen_helper_flush_flags(QREG_CC_DEST, cpu_env, tcg_const_i32(s->cc_op)); > + } That const needs to be freed. > @@ -1248,7 +1294,6 @@ DISAS_INSN(bitop_im) > DEST_EA(env, insn, opsize, tmp, &addr); > } > } > - > DISAS_INSN(arith_im) > { > int op; Careful with the errant whitespace changes. > @@ -1706,16 +1745,18 @@ DISAS_INSN(branch) > /* bsr */ > gen_push(s, tcg_const_i32(s->pc)); > } > - gen_flush_cc_op(s); > if (op > 1) { > /* Bcc */ > l1 = gen_new_label(); > gen_jmpcc(s, ((insn >> 8) & 0xf) ^ 1, l1); > + update_cc_op(s); > gen_jmp_tb(s, 1, base + offset); > gen_set_label(l1); > + update_cc_op(s); > gen_jmp_tb(s, 0, s->pc); Ideally you'd do this only once, before the jmpcc. r~