On 8/13/19 1:49 PM, Alex Bennée wrote: > +static FloatParts parts_squash_denormal(FloatParts p, float_status *status) > +{ > + if (p.exp == 0 && p.frac != 0) { > + float_raise(float_flag_input_denormal, status); > + p.frac = 0; > + p.cls = float_class_zero; > + } > + > + return p; > +} > + > +float16 float16_squash_input_denormal(float16 a, float_status *status) > +{ > + if (status->flush_inputs_to_zero) { > + FloatParts p = float16_unpack_raw(a); > + p = parts_squash_denormal(p, status); > + return float16_pack_raw(p); > + } > + return a; > +}
Hmm. Maybe avoid the re-pack in the likely chance that we can? static bool parts_squash_denormal(FloatParts p, float_status *status) { if (p.exp == 0 && p.frac != 0) { float_raise(float_flag_input_denormal, status); return true; } return false; } float16 float16_squash_input_denormal(float16 a, float_status *status) { if (status->flush_inputs_to_zero) { FloatParts p = float16_unpack_raw(a); if (parts_squash_denormal(p, status)) { return float16_set_sign(float16_zero, p.sign); } } return a; }