From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZPVb-0006UU-A0 for qemu-devel@nongnu.org; Mon, 06 May 2013 13:47:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZPVZ-00021o-Vt for qemu-devel@nongnu.org; Mon, 06 May 2013 13:47:31 -0400 Message-ID: <5187ECAD.4050901@suse.de> Date: Mon, 06 May 2013 19:47:25 +0200 From: Alexander Graf MIME-Version: 1.0 References: <86sj20rql4.fsf@shell.gmplib.org> In-Reply-To: <86sj20rql4.fsf@shell.gmplib.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Incorrect handling of PPC64 rldcl insn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Torbjorn Granlund Cc: "" , qemu-devel@nongnu.org On 05/06/2013 07:00 PM, Torbjorn Granlund wrote: > I could finally make Debian GNU/Linux install and run under > qemu-system-ppc64. I used Debian 7.0.0 and qemu from the main git repo, > updated a few days ago. > > While Debian runs well and not too slowly, GMP fails badly under all > ABIs, and in many different ways. I have isolated the first problem. > > Test case: > > #include > int > main () > { > unsigned long r; > asm ("rldcl\t%0, %1, %2, 0" : "=r" (r) : "r" (0xcafebabedeadbeeful), "r" (16)); > printf ("%lx\n", r); > return 0; > } > > Expected output: > babedeadbeefcafe > > Output under qemu: > 0 > > I have single stepped in gdb to determine that it is indeed rldcl that > misbehaves. Thanks a lot for the bug report and test case! Please CC qemu-ppc whenever you find issues or have patches for PPC. That makes filtering for important mails a lot easier. Does the patch below fix the issue for you? Alex diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 0886f4d..a018616 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -1733,8 +1733,6 @@ static inline void gen_rldnm(DisasContext *ctx, uint32_t mb, uint32_t me) { TCGv t0; - mb = MB(ctx->opcode); - me = ME(ctx->opcode); t0 = tcg_temp_new(); tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f); tcg_gen_rotl_tl(t0, cpu_gpr[rS(ctx->opcode)], t0);