Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MofLD-0004oC-3k for qemu-devel@nongnu.org; Fri, 18 Sep 2009 11:25:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MofL9-0004m7-KI for qemu-devel@nongnu.org; Fri, 18 Sep 2009 11:25:40 -0400 Received: from [199.232.76.173] (port=49799 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MofL9-0004m0-ES for qemu-devel@nongnu.org; Fri, 18 Sep 2009 11:25:39 -0400 Received: from hall.aurel32.net ([88.191.82.174]:51788) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MofL9-0003XI-1A for qemu-devel@nongnu.org; Fri, 18 Sep 2009 11:25:39 -0400 Date: Fri, 18 Sep 2009 17:25:37 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] Fix extlh instruction on Alpha Message-ID: <20090918152537.GB32102@hall.aurel32.net> References: <20090917152502.G54732@stanley.csl.cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20090917152502.G54732@stanley.csl.cornell.edu> Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vince Weaver Cc: qemu-devel@nongnu.org On Thu, Sep 17, 2009 at 03:28:52PM -0400, Vince Weaver wrote: > > The extlh instruction on Alpha currently doesn't work properly. > It's a combination of a cut/paste bug (16 where it should be 32) as well > as a "shift by 64" bug. > > This improves on an earlier patch that used labels, conditional jumps, > and local variables. Thanks go especially to Aurelien Jarno and Andreas > Schwab who have a much better eye for bit-wise TCG optimization than I do. > > Vince > > Signed-off-by: Vince Weaver Thanks, applied to both master and stable-0.11. > diff --git a/target-alpha/translate.c b/target-alpha/translate.c > index 9d2bc45..9e7e9b2 100644 > --- a/target-alpha/translate.c > +++ b/target-alpha/translate.c > @@ -524,14 +524,15 @@ static inline void gen_ext_h(void(*tcg_gen_ext_i64)(TCGv t0, TCGv t1), > else > tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]); > } else { > - TCGv tmp1, tmp2; > + TCGv tmp1; > tmp1 = tcg_temp_new(); > + > tcg_gen_andi_i64(tmp1, cpu_ir[rb], 7); > tcg_gen_shli_i64(tmp1, tmp1, 3); > - tmp2 = tcg_const_i64(64); > - tcg_gen_sub_i64(tmp1, tmp2, tmp1); > - tcg_temp_free(tmp2); > + tcg_gen_neg_i64(tmp1, tmp1); > + tcg_gen_andi_i64(tmp1, tmp1, 0x3f); > tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], tmp1); > + > tcg_temp_free(tmp1); > } > if (tcg_gen_ext_i64) > @@ -1316,7 +1317,7 @@ static inline int translate_one(DisasContext *ctx, uint32_t insn) > break; > case 0x6A: > /* EXTLH */ > - gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); > + gen_ext_h(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit); > break; > case 0x72: > /* MSKQH */ > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net