On 9 January 2015 at 16:08, Frediano Ziglio wrote:
> I agree (after some digging) we are not sure we won't get that
> overflow. Agree to drop the second patch. However I would retain the
> first. Compiler can use it to optimize much easier. For instance if
> compiler understand that the multiplica
2015-01-09 15:52 GMT+00:00 Peter Maydell :
> On 9 January 2015 at 15:41, Frediano Ziglio wrote:
>> 2015-01-09 12:22 GMT+00:00 Peter Maydell :
+/* Optimised x64 version. This assume that a*b/c fits in 64 bit */
>>>
>>> This assumption isn't necessarily true, and this implementation
>>> will du
On 9 January 2015 at 15:41, Frediano Ziglio wrote:
> 2015-01-09 12:22 GMT+00:00 Peter Maydell :
>>> +/* Optimised x64 version. This assume that a*b/c fits in 64 bit */
>>
>> This assumption isn't necessarily true, and this implementation
>> will dump core on overflow.
> Yes, I know, it was meant
2015-01-09 12:22 GMT+00:00 Peter Maydell :
> On 9 January 2015 at 11:25, Frediano Ziglio wrote:
>> As this platform can do multiply/divide using 128 bit precision use
>> these instructions to implement it.
>>
>> Signed-off-by: Frediano Ziglio
>> ---
>> include/qemu-common.h | 14 +-
>
On 9 January 2015 at 11:25, Frediano Ziglio wrote:
> As this platform can do multiply/divide using 128 bit precision use
> these instructions to implement it.
>
> Signed-off-by: Frediano Ziglio
> ---
> include/qemu-common.h | 14 +-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
2015-01-09 11:43 GMT+00:00 Paolo Bonzini :
>
>
> On 09/01/2015 12:25, Frediano Ziglio wrote:
>> /* compute with 96 bit intermediate result: (a*b)/c */
>> -#ifdef CONFIG_INT128
>> +#if defined(CONFIG_INT128) && !defined(__x86_64__)
>> static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_
On 09/01/2015 12:25, Frediano Ziglio wrote:
> /* compute with 96 bit intermediate result: (a*b)/c */
> -#ifdef CONFIG_INT128
> +#if defined(CONFIG_INT128) && !defined(__x86_64__)
> static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
> {
> return (__int128)a * b / c;
> }
>
As this platform can do multiply/divide using 128 bit precision use
these instructions to implement it.
Signed-off-by: Frediano Ziglio
---
include/qemu-common.h | 14 +-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index