X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fconst_stat.c;h=ffa88a32b10a113d61e0648404d0d734e0a7bf99;hb=f6aeac6a547a52beb3cb663c5e63c05c9c3728ea;hp=cde1994a4efe248f5c6380754c5a5792d8723b85;hpb=1ce363f80e6a204d4011f85813362d9bd1d0e7e4;p=libfirm diff --git a/ir/stat/const_stat.c b/ir/stat/const_stat.c index cde1994a4..ffa88a32b 100644 --- a/ir/stat/const_stat.c +++ b/ir/stat/const_stat.c @@ -69,23 +69,33 @@ static float_classify_t classify_float_value(tarval *tv) { ir_mode *mode = get_tarval_mode(tv); if (tv == get_mode_null(mode)) - return STAT_FC_1; + return STAT_FC_0; else if (tv == get_mode_one(mode)) return STAT_FC_1; - + else if (tarval_is_finite(tv) && tarval_ieee754_zero_mantissa(tv)) { + int exp = tarval_ieee754_get_exponent(tv); + + if (! tarval_is_negative(tv)) { + if (exp == 1) + return STAT_FC_2; + else if (exp == -1) + return STAT_FC_0_5; + } + return STAT_FC_POWER_OF_TWO; + } return STAT_FC_OTHER; } /* return a human readable name for an float classification */ const char *stat_fc_name(float_classify_t classification) { switch (classification) { - case STAT_FC_0: return "0.0"; - case STAT_FC_1: return "1.0"; - case STAT_FC_2: return "2.0"; - case STAT_FC_0_5: return "0.5"; - case STAT_FC_EXACT: return "exact"; - case STAT_FC_OTHER: return "other"; - default: return ""; + case STAT_FC_0: return "0.0"; + case STAT_FC_1: return "1.0"; + case STAT_FC_2: return "2.0"; + case STAT_FC_0_5: return "0.5"; + case STAT_FC_POWER_OF_TWO: return "2.0^x"; + case STAT_FC_OTHER: return "other"; + default: return ""; } }