From patchwork Wed Sep 9 16:08:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vince Weaver X-Patchwork-Id: 33214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id C2307B7043 for ; Thu, 10 Sep 2009 03:13:31 +1000 (EST) Received: from localhost ([127.0.0.1]:41720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlQjY-0003J4-VO for incoming@patchwork.ozlabs.org; Wed, 09 Sep 2009 13:13:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlPil-0005HT-UP for qemu-devel@nongnu.org; Wed, 09 Sep 2009 12:08:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlPih-0005Ev-AM for qemu-devel@nongnu.org; Wed, 09 Sep 2009 12:08:35 -0400 Received: from [199.232.76.173] (port=60722 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlPih-0005En-2l for qemu-devel@nongnu.org; Wed, 09 Sep 2009 12:08:31 -0400 Received: from csl.cornell.edu ([128.84.224.10]:2732 helo=vlsi.csl.cornell.edu) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlPig-0003ey-ND for qemu-devel@nongnu.org; Wed, 09 Sep 2009 12:08:30 -0400 Received: from stanley.csl.cornell.edu (stanley.csl.cornell.edu [128.84.224.15]) by vlsi.csl.cornell.edu (8.13.4/8.13.4) with ESMTP id n89G8PJt053514 for ; Wed, 9 Sep 2009 12:08:30 -0400 (EDT) Date: Wed, 9 Sep 2009 12:08:25 -0400 (EDT) From: Vince Weaver To: qemu-devel@nongnu.org Message-ID: <20090909120628.J4195@stanley.csl.cornell.edu> MIME-Version: 1.0 Content-ID: <20090807173221.N10097@stanley.csl.cornell.edu> X-detected-operating-system: by monty-python.gnu.org: FreeBSD 2.0-4.2 Subject: [Qemu-devel] [PATCH] Fix extlh instruction on Alpha X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org (re-sending) 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. Below is a patch that fixes the problem. The previous e-mails on this problem have test cases that exhibit the bug. This patch uses tcg_temp_local_new() at the suggestion of Filip Navara. Vince Signed-off-by: Vince Weaver diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 1fc5119..4219916 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -526,14 +526,24 @@ static always_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 { + int l1; TCGv tmp1, tmp2; - tmp1 = tcg_temp_new(); + tmp1 = tcg_temp_local_new(); + l1 = gen_new_label(); + tcg_gen_andi_i64(tmp1, cpu_ir[rb], 7); tcg_gen_shli_i64(tmp1, tmp1, 3); + + tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]); + tcg_gen_brcondi_i64(TCG_COND_EQ, tmp1, 0, l1); + tmp2 = tcg_const_i64(64); tcg_gen_sub_i64(tmp1, tmp2, tmp1); tcg_temp_free(tmp2); tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], tmp1); + + gen_set_label(l1); + tcg_temp_free(tmp1); } if (tcg_gen_ext_i64) @@ -1320,7 +1330,7 @@ static always_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 */