[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/7] target/m68k: add fsglmul and fsgldiv
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH 3/7] target/m68k: add fsglmul and fsgldiv |
Date: |
Mon, 26 Jun 2017 10:05:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
Le 25/06/2017 à 21:44, Philippe Mathieu-Daudé a écrit :
> Hi Laurent,
>
> On 06/25/2017 04:21 PM, Laurent Vivier wrote:
>> fsglmul and fsgldiv truncate data to single precision before computing
>> results.
>>
>> Signed-off-by: Laurent Vivier <address@hidden>
>> ---
>> target/m68k/fpu_helper.c | 22 ++++++++++++++++++++++
>> target/m68k/helper.h | 2 ++
>> target/m68k/translate.c | 6 ++++++
>> 3 files changed, 30 insertions(+)
>>
>> diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
>> index 912c0b7..0d83925 100644
>> --- a/target/m68k/fpu_helper.c
>> +++ b/target/m68k/fpu_helper.c
>> @@ -183,11 +183,33 @@ void HELPER(fmul)(CPUM68KState *env, FPReg *res,
>> FPReg *val0, FPReg *val1)
>> res->d = floatx80_mul(val0->d, val1->d, &env->fp_status);
>> }
>> +void HELPER(fsglmul)(CPUM68KState *env, FPReg *res, FPReg *val0,
>> FPReg *val1)
>> +{
>> + float32 a, b, c;
>> +
>> + a = floatx80_to_float32(val0->d, &env->fp_status);
>> + b = floatx80_to_float32(val1->d, &env->fp_status);
>> + c = float32_mul(a, b, &env->fp_status);
>
> Why not use floatx80_mul() directly?
>
>> +
>> + res->d = float32_to_floatx80(c, &env->fp_status);
>> +}
>> +
>> void HELPER(fdiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg
>> *val1)
>> {
>> res->d = floatx80_div(val1->d, val0->d, &env->fp_status);
>> }
>> +void HELPER(fsgldiv)(CPUM68KState *env, FPReg *res, FPReg *val0,
>> FPReg *val1)
>> +{
>> + float32 a, b, c;
>> +
>> + a = floatx80_to_float32(val1->d, &env->fp_status);
>> + b = floatx80_to_float32(val0->d, &env->fp_status);
>> + c = float32_div(a, b, &env->fp_status);
>
> floatx80_div()?
>
Just to follow the spec of the instruction:
"if either operand requires more than 24 bits of mantissa to be
accurately represented, the extraneous mantissa bits are truncated prior
to the multiplication;"
Do you think I should keep them in floatx80 and use the floatx80_round()
(I introduce latter in the series) to reduce the precision prior the
floatx80_mul()?
Thanks,
Laurent
- [Qemu-devel] [PATCH 0/7] target/m68k: implement 680x0 FPU (part 2), Laurent Vivier, 2017/06/25
- [Qemu-devel] [PATCH 1/7] target/m68k: add fscc., Laurent Vivier, 2017/06/25
- [Qemu-devel] [PATCH 5/7] softfloat: define floatx80_round(), Laurent Vivier, 2017/06/25
- [Qemu-devel] [PATCH 2/7] target/m68k: add fmovecr, Laurent Vivier, 2017/06/25
- [Qemu-devel] [PATCH 6/7] target/m68k: add explicit single and double precision operations (part 2), Laurent Vivier, 2017/06/25