qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/11] target-i386: use floatx80 constants in he


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 06/11] target-i386: use floatx80 constants in helper_fld*_ST0()
Date: Sun, 29 May 2011 13:43:55 +0200
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1.7) Gecko/20100214 Lightning/1.0b1 Thunderbird/3.0.1

Am 21.05.11 11:35, schrieb Andreas Färber:
Am 20.05.2011 um 12:32 schrieb Peter Maydell:

On 15 May 2011 15:13, Aurelien Jarno <address@hidden> wrote:
Instead of using a table which doesn't correspond to anything from
physical in the CPU, use directly the constants in helper_fld*_ST0().

Actually I rather suspect there is effectively a table in the CPU
indexed by the last 3 bits of the FLD* opcode... It would be
possible to implement this group of insns in QEMU with a single
helper function that took the index into the array, but since the
array seems to be causing weird compilation problems we might
as well stick with the lots-of-helpers approach, at which point
this is a sensible cleanup.

In OpenBIOS we once ran into a similar error on ppc64 where a cast would've resulted in the truncation of a static pointer ... could this be an alignment issue here, that it's being truncated by the floatx80 cast? I tried using __attribute__((packed)) on the floatx80 type without luck. Or maybe the constant width is being handled weird, with LL being 128 bits rather than the expected 64 bits? ;)

Some more info:

The issue only pops up with -std=c99 or -std=gnu99, with both gcc 3.4.3 and 4.3.2. That's reproducible on Darwin gcc 4.0.1 and 4.2 as well.

The following trivial sample program triggers it, there's no magic Solaris headers involved:

#include <inttypes.h>
// on OpenSolaris:
// typedef unsigned short uint16_t;
// typedef unsigned long long uint64_t;

typedef struct {
    uint64_t low;
    uint16_t high;
} floatx80;
#define make_floatx80(exp, mant) ((floatx80) { mant, exp })

#define floatx80_l2t make_floatx80( 0x4000, 0xd49a784bcd1b8afeLL )

static const floatx80 mine[1] = {
    floatx80_l2t,
};

int main(void)
{
}

Any thoughts?

Andreas



reply via email to

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