From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPa9Y-0006Fd-2F for qemu-devel@nongnu.org; Wed, 12 Aug 2015 13:49:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPa9V-0008Ta-BD for qemu-devel@nongnu.org; Wed, 12 Aug 2015 13:49:28 -0400 Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:36545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPa9V-0008TU-6s for qemu-devel@nongnu.org; Wed, 12 Aug 2015 13:49:25 -0400 Received: by qkdv3 with SMTP id v3so7653960qkd.3 for ; Wed, 12 Aug 2015 10:49:24 -0700 (PDT) Sender: Richard Henderson References: <1439151229-27747-1-git-send-email-laurent@vivier.eu> <1439151229-27747-25-git-send-email-laurent@vivier.eu> From: Richard Henderson Message-ID: <55CB8721.7020306@twiddle.net> Date: Wed, 12 Aug 2015 10:49:21 -0700 MIME-Version: 1.0 In-Reply-To: <1439151229-27747-25-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.5 24/30] m68k: add DBcc and Scc (memory operand) 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: > +DISAS_INSN(scc_mem) > +{ > + TCGLabel *l1; > + int cond; > + TCGv dest; > + > + l1 = gen_new_label(); > + cond = (insn >> 8) & 0xf; > + dest = tcg_temp_local_new(); > + tcg_gen_movi_i32(dest, 0); > + gen_jmpcc(s, cond ^ 1, l1); > + tcg_gen_movi_i32(dest, 0xff); > + gen_set_label(l1); > + DEST_EA(env, insn, OS_BYTE, dest, NULL); > + tcg_temp_free(dest); > +} It seems like this could just as easily be shared with scc? DEST_EA handles a byte store into a register just fine. I suppose the real ugliness at the moment is the tcg branch; if you were using setcond instead that would help matters. Adjusting the code surrounding gen_jmpcc is a larger task, but it really would help a lot. There are several examples of how to organize such a thing... > +DISAS_INSN(dbcc) > +{ > + TCGLabel *l1; > + TCGv reg; > + TCGv tmp; > + int16_t offset; > + uint32_t base; > + > + reg = DREG(insn, 0); > + base = s->pc; > + offset = cpu_ldsw_code(env, s->pc); > + s->pc += 2; read_im16? > + l1 = gen_new_label(); > + gen_jmpcc(s, (insn >> 8) & 0xf, l1); > + > + tmp = tcg_temp_new(); > + tcg_gen_ext16s_i32(tmp, reg); > + tcg_gen_addi_i32(tmp, tmp, -1); > + gen_partset_reg(OS_WORD, reg, tmp); > + tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, -1, l1); > + update_cc_op(s); > + gen_jmp_tb(s, 1, base + offset); > + gen_set_label(l1); > + update_cc_op(s); Move the update_cc_op calls before the first branch. r~