qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions
Date: Tue, 24 Jun 2014 11:33:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 06/24/2014 09:52 AM, Al Viro wrote:
> unsigned long __attribute__((noinline)) f(double x)
> {
>         return (unsigned long)x;        // SVCTQ/SVC
> }
> 
> main()
> {
>         unsigned long x;
>         extern unsigned long __ieee_get_fp_control(void);
>         printf("before:%lx\n", __ieee_get_fp_control());
>         x = f(1ULL<<63);
>         printf("after:%lx\n", __ieee_get_fp_control());
>         printf("result:%lx\n", x);
> }
> 
> On actual hardware:
> before:0
> after:20000
> result:8000000000000000
> 
> On qemu:
> before:0
> after:0
> result:8000000000000000
> 
> 
> IOW, gen_fcvttq() is also affected, not only gen_fp_exc_raise().

Clearly a gross misunderstanding of what bits are actually computed, never mind
what gets signaled.

Thanks for the test.  I've not had working hardware for a couple of years to
validate what's supposed to get set and what isn't.

> Can't we simply have separate helpers for various trap suffices, with
> all this work on getting exc, etc. taken inside them?  It's not as if
> we distinguished many variants, after all...  Right now we have:
>       plain, /U, /V
>       /S, /SU
>       /SUI
>       /SV
>       /SVI

We used to have separate helpers... at least for the modes that had been
implemented at the time.  The combinatorial explosion ugly though -- 4
different versions of add, sub, etc.  I thought the partial inlining was a
decent solution, as far as maintainability, but it's not unreasonable to 
disagree.

> Another thing: shouldn't arithmetics on denorms without /S raise EXC_M_INV,
> rather than EXC_M_UNF?

No idea.  Should they?


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]