On 3/12/20 7:58 AM, LIU Zhiwei wrote: > +/* Vector Floating-Point Classify Instruction */ > +static uint16_t fclass_f16(uint16_t frs1, float_status *s) > +{ > + float16 f = frs1; > + bool sign = float16_is_neg(f); > + > + if (float16_is_infinity(f)) { > + return sign ? 1 << 0 : 1 << 7; > + } else if (float16_is_zero(f)) { > + return sign ? 1 << 3 : 1 << 4; > + } else if (float16_is_zero_or_denormal(f)) { > + return sign ? 1 << 2 : 1 << 5; > + } else if (float16_is_any_nan(f)) { > + float_status s = { }; /* for snan_bit_is_one */ > + return float16_is_quiet_nan(f, &s) ? 1 << 9 : 1 << 8; > + } else { > + return sign ? 1 << 1 : 1 << 6; > + } > +} > +static uint32_t fclass_s(uint32_t frs1, float_status *s) > +{ > + float32 f = frs1; > + bool sign = float32_is_neg(f); > + > + if (float32_is_infinity(f)) { > + return sign ? 1 << 0 : 1 << 7; > + } else if (float32_is_zero(f)) { > + return sign ? 1 << 3 : 1 << 4; > + } else if (float32_is_zero_or_denormal(f)) { > + return sign ? 1 << 2 : 1 << 5; > + } else if (float32_is_any_nan(f)) { > + float_status s = { }; /* for snan_bit_is_one */ > + return float32_is_quiet_nan(f, &s) ? 1 << 9 : 1 << 8; > + } else { > + return sign ? 1 << 1 : 1 << 6; > + } > +} > +static uint64_t fclass_d(uint64_t frs1, float_status *s) > +{ > + float64 f = frs1; > + bool sign = float64_is_neg(f); > + > + if (float64_is_infinity(f)) { > + return sign ? 1 << 0 : 1 << 7; > + } else if (float64_is_zero(f)) { > + return sign ? 1 << 3 : 1 << 4; > + } else if (float64_is_zero_or_denormal(f)) { > + return sign ? 1 << 2 : 1 << 5; > + } else if (float64_is_any_nan(f)) { > + float_status s = { }; /* for snan_bit_is_one */ > + return float64_is_quiet_nan(f, &s) ? 1 << 9 : 1 << 8; > + } else { > + return sign ? 1 << 1 : 1 << 6; > + } > +}
These need to be moved out of fpu_helper.c so they can be shared. r~