[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] sparc smul problem
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] sparc smul problem |
Date: |
Mon, 1 Sep 2008 22:05:45 +0300 |
On 9/1/08, Vince Weaver <address@hidden> wrote:
> Hello!
>
> I've been stuck on this all weekend, as I can't find where the actual
> problem is. I might be completely missing it, but I've tried a lot of things
> and can't make it work.
>
> On SPARC, the "smul" instruction multiplies two numbers, puts the result in
> the result register but also puts the top 32-bits of the 64-bit result into
> the "Y" register.
>
> As the attached code shows, the value of "Y" is wrong. Somehow after the
> multiply, the top 32 bits of the product rae all zeros. I've played around
> with the code generated by translate.c, and it looks like the shift and
> other instructions all work properly, but the 64-bit multiply the result is
> somehow being truncated. But I've looked at the generated code (on x86_64)
> and it looks like it is doing the right thing.
>
> So anyway, I'll have to take a look at this again later, but in case anyone
> else wants to look at it in case I am missing anything obvious.
It looks like TCG on i386 host generates incorrect code for mulu2_i32,
I think the op should be imul (unsigned) instead of mul. This patch
fixes the problem.
fix_tcg_i386_mulu2.diff
Description: plain/text