From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXs2K-0004yp-LV for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXs2H-00086G-Fv for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:32:16 -0400 Received: from mail-qg0-x230.google.com ([2607:f8b0:400d:c04::230]:33385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXs2H-00086C-CQ for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:32:13 -0400 Received: by qgev79 with SMTP id v79so17202517qge.0 for ; Fri, 04 Sep 2015 07:32:13 -0700 (PDT) Sender: Richard Henderson References: <1441234214-25173-1-git-send-email-rth@twiddle.net> <1441234214-25173-2-git-send-email-rth@twiddle.net> <55E87CDD.8000307@imgtec.com> From: Richard Henderson Message-ID: <55E9AB6A.2050808@twiddle.net> Date: Fri, 4 Sep 2015 07:32:10 -0700 MIME-Version: 1.0 In-Reply-To: <55E87CDD.8000307@imgtec.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/2] target-mips: Use movcond in movci and movcf* List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae , qemu-devel@nongnu.org Cc: aurelien@aurel32.net On 09/03/2015 10:01 AM, Leon Alrae wrote: > On 02/09/2015 23:50, Richard Henderson wrote: >> @@ -8821,102 +8840,126 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs) >> tcg_temp_free(t0); >> } >> >> -static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) >> +static void gen_movci(DisasContext *ctx, int rd, int rs, int cc, int tf) >> { >> - TCGLabel *l1; >> TCGCond cond; >> - TCGv_i32 t0; >> + TCGv t0, ts, zero; >> >> if (rd == 0) { >> /* Treat as NOP. */ >> return; >> } >> >> - if (tf) >> + if (tf) { >> cond = TCG_COND_EQ; >> - else >> - cond = TCG_COND_NE; >> - >> - l1 = gen_new_label(); >> - t0 = tcg_temp_new_i32(); >> - tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc)); >> - tcg_gen_brcondi_i32(cond, t0, 0, l1); >> - tcg_temp_free_i32(t0); >> - if (rs == 0) { >> - tcg_gen_movi_tl(cpu_gpr[rd], 0); >> } else { >> - tcg_gen_mov_tl(cpu_gpr[rd], cpu_gpr[rs]); >> + cond = TCG_COND_NE; >> } >> - gen_set_label(l1); >> + >> + t0 = tcg_temp_new(); >> + tcg_gen_extu_i32_tl(t0, fpu_fcr31); >> + tcg_gen_andi_tl(t0, t0, 1 << get_fp_bit(cc)); >> + >> + zero = tcg_const_tl(0); >> + ts = rs ? cpu_gpr[rs] : zero; >> + tcg_gen_movcond_tl(cond, cpu_gpr[rd], t0, zero, ts, cpu_gpr[rd]); > > MOVF and MOVT seem to do the opposite now, ts and cpu_gpr[rd] should be > swapped I think: > > tcg_gen_movcond_tl(cond, cpu_gpr[rd], t0, zero, cpu_gpr[rd], ts); Whoops. I guess my test kernel isn't built to use that. Anyway, yes, either that or swap the setting of cond above, which is probably a more natural way to write the condition. r~