On 6 February 2018 at 16:48, Alex Bennée <[email protected]> wrote:
> We can now add float16_div and use the common decompose and
> canonicalize functions to have a single implementation for
> float16/32/64 versions.
>
> Signed-off-by: Alex Bennée <[email protected]>
> Signed-off-by: Richard Henderson <[email protected]>
> +static FloatParts div_floats(FloatParts a, FloatParts b, float_status *s)
> +{
> + bool sign = a.sign ^ b.sign;
> +
> + if (a.cls == float_class_normal && b.cls == float_class_normal) {
> + uint64_t temp_lo, temp_hi;
> + int exp = a.exp - b.exp;
> + if (a.frac < b.frac) {
> + exp -= 1;
> + shortShift128Left(0, a.frac, DECOMPOSED_BINARY_POINT + 1,
> + &temp_hi, &temp_lo);
> + } else {
> + shortShift128Left(0, a.frac, DECOMPOSED_BINARY_POINT,
> + &temp_hi, &temp_lo);
> + }
> + /* LSB of quot is set if inexact which roundandpack will use
> + * to set flags. Yet again we re-use a for the result */
> + a.frac = div128To64(temp_lo, temp_hi, b.frac);
...and this is even worse as a cost increase for the float32
and float16 cases. Still:
Reviewed-by: Peter Maydell <[email protected]>
thanks
-- PMM