qemu-ppc
[Top][All Lists]

## Re: R: R: About hardfloat in ppc

 From: Yonggang Luo Subject: Re: R: R: About hardfloat in ppc Date: Thu, 30 Apr 2020 16:13:33 +0800

I propose a new way to computing the float flags,
We preserve a  float computing cash
typedef struct FpRecord {
uint8_t op;
float32 A;
float32 B;
}  FpRecord;
FpRecord fp_cache[1024];
int fp_cache_length;
uint32_t fp_exceptions;

1. For each new fp operation we push it to the  fp_cache,
2. Once we read the fp_exceptions , then we re-compute
the fp_exceptions by re-running the fp FpRecord sequence.
and clear  fp_cache_length.
3. If we clear the fp_exceptions , then we set fp_cache_length to 0 and
clear  fp_exceptions.
4. If the  fp_cache are full, then we re-compute
the fp_exceptions by re-running the fp FpRecord sequence.

Would this be a general method to use hard-float?
The consued time should be  2*hard_float.
Considerating read fp_exceptions are rare, then the amortized time complexity
would be 1 * hard_float.

On Thu, Apr 30, 2020 at 10:18 AM Richard Henderson <address@hidden> wrote:
On 4/29/20 5:20 PM, 罗勇刚(Yonggang Luo) wrote:
> Question, in hard-float, if we don't want to read the fp register.
> for example: If we wanna compute c = a + b in fp32
> if c = a + b In hard float
> and if b1 = c - a in hard float
> if b1 != b at bitwise level, the we se the inexat to 1, otherwsie
> we set inexat bit to 0? are this valid?
>
> we can also do it for a * b, a - b, a / b.
>

That does seem plausible, for all of the normal values for which we would apply
the hard-float optimization anyway.  But we already check for the exceptional
cases:

if (unlikely(f32_is_inf(ur))) {
s->float_exception_flags |= float_flag_overflow;
} else if (unlikely(fabsf(ur.h) <= FLT_MIN)) {
if (post == NULL || post(ua, ub)) {
goto soft;
}
}

r~

--
此致

Yours
sincerely,
Yonggang Luo