Message ID | 4F858E5B.1070803@codesourcery.com |
---|---|
State | New |
Headers | show |
On Wed, Apr 11, 2012 at 3:59 PM, Bernd Schmidt <bernds@codesourcery.com> wrote: > This is another problem I found working on a new target. In fold-const, > when folding conversions, there are two instances where mode bitsizes > are compared to type precisions. This fails to do the right thing if > mode precision and bitsize differ (which I believe they currently don't > on any target). > > Bootstrapped and regression tested on i686-linux. Ok? Ok. Please also adjust the corresponding duplicate code in tree-ssa-forwprop.c Thanks, Richard. > > Bernd
On Apr 11, 2012, at 6:59 AM, Bernd Schmidt wrote: > This is another problem I found working on a new target. In fold-const, > when folding conversions, there are two instances where mode bitsizes > are compared to type precisions. This fails to do the right thing if > mode precision and bitsize differ (which I believe they currently don't > on any target). They do on mine... In my genmodes patch, it would make it true on two existing gcc ports as I recall.
Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 365109) +++ gcc/fold-const.c (working copy) @@ -8586,7 +8586,7 @@ fold_unary_loc (location_t loc, enum tre && inter_prec >= inside_prec && (inter_float || inter_vec || inter_unsignedp == inside_unsignedp) - && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (type)) + && ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type)) && TYPE_MODE (type) == TYPE_MODE (inter_type)) && ! final_ptr && (! final_vec || inter_prec == inside_prec)) @@ -8620,7 +8620,7 @@ fold_unary_loc (location_t loc, enum tre == (final_unsignedp && final_prec > inter_prec)) && ! (inside_ptr && inter_prec != final_prec) && ! (final_ptr && inside_prec != inter_prec) - && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (type)) + && ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type)) && TYPE_MODE (type) == TYPE_MODE (inter_type))) return fold_build1_loc (loc, code, type, TREE_OPERAND (op0, 0)); }