On 2020/6/9 3:34, Richard Henderson wrote:
On 6/8/20 5:53 AM, LIU Zhiwei wrote:
Hi Richard,
I am doing bfloat16 support on QEMU.
Once I tried to reuse float32 interface, but I couldn't properly process
rounding in some insns like fadd.
What's your opinion about it? Should I expand the fpu/softfloat?
Yes, we need to expand fpu/softfloat.
You'll want something like
static const FloatFmt bfloat16_params = {
FLOAT_PARAMS(8, 7)
};
(This would be the Arm and x86 definition, anyway; hopefully risc-v is the
same.)
Yes. It's the same for me.
And then add all of the other interface functions that you need to use that
parameter.
FWIW, it appears that Arm only requires:
float32_to_bfloat16
bfloat16_mul
bfloat16_add
and I could even get away with only float32_to_bfloat16, since technically
Arm's BFAdd and BFMul psuedo-code are implemented in terms of single-precision
arithmetic, followed by a round-to-odd into BFloat16.
Some different here.
It's directly implemented in half-precision unit. So I'm afraid I have
to implement as many as interfaces like float16.
Best Regards,
Zhiwei
r~