[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers |
Date: |
Thu, 24 Mar 2011 10:41:56 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 |
On 03/24/2011 10:29 AM, Peter Maydell wrote:
> On 24 March 2011 15:58, Alexander Graf <address@hidden> wrote:
>
> This is more random comments in passing than a thorough review; sorry.
>
>> +#if HOST_LONG_BITS == 64 && defined(__GNUC__)
>> + /* assuming 64-bit hosts have __uint128_t */
>> + __uint128_t dividend = (((__uint128_t)env->regs[r1]) << 64) |
>> + (env->regs[r1+1]);
>> + __uint128_t quotient = dividend / divisor;
>> + env->regs[r1+1] = quotient;
>> + __uint128_t remainder = dividend % divisor;
>> + env->regs[r1] = remainder;
>> +#else
>> + /* 32-bit hosts would need special wrapper functionality - just
>> abort if
>> + we encounter such a case; it's very unlikely anyways. */
>> + cpu_abort(env, "128 -> 64/64 division not implemented\n");
>> +#endif
>
> ...I'm still using a 32 bit system :-)
A couple of options:
(1) Steal code from gcc's __[u]divdi3 for implementing double-word division via
single-word division. In this case, your "single-word" will be long long.
(2) Implement a simple bit reduction loop. This is probably easiest.
(3) Reuse some of the softfloat code that manipulates 128bit quantities. This
is probably the best option, particularly if the availability of __uint128
is taught to softfloat so that it doesn't always open-code stuff that the
compiler could take care of.
r~
- Re: [Qemu-devel] [PATCH 10/17] s390x: Adjust GDB stub, (continued)
- [Qemu-devel] [PATCH 03/17] s390x: Enable disassembler for s390x, Alexander Graf, 2011/03/24
- [Qemu-devel] [PATCH 12/17] s390x: Prepare cpu.h for emulation, Alexander Graf, 2011/03/24
- [Qemu-devel] [PATCH 13/17] s390x: helper functions for system emulation, Alexander Graf, 2011/03/24
- [Qemu-devel] [PATCH 06/17] s390x: s390x-linux-user support, Alexander Graf, 2011/03/24
- [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Alexander Graf, 2011/03/24
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Peter Maydell, 2011/03/24
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Alexander Graf, 2011/03/24
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Alexander Graf, 2011/03/28
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Richard Henderson, 2011/03/28
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Peter Maydell, 2011/03/28
- Re: [Qemu-devel] [PATCH 14/17] s390x: Implement opcode helpers, Alexander Graf, 2011/03/29
[Qemu-devel] [PATCH 16/17] s390x: translate engine for s390x CPU, Alexander Graf, 2011/03/24