On Wed, Apr 05, 2017 at 11:11:54AM -0400, Vladimir Makarov wrote: > --- ira-color.c (revision 246536) > +++ ira-color.c (working copy) > @@ -1367,6 +1367,16 @@ update_costs_from_allocno (ira_allocno_t > || ALLOCNO_ASSIGNED_P (another_allocno)) > continue; > > + if (GET_MODE_SIZE (ALLOCNO_MODE (cp->second)) < GET_MODE_SIZE (mode)) > + /* If we have different modes use the smallest one. It is > + a sub-register move. It is hard to predict what LRA > + will reload (the pseudo or its sub-register) but LRA > + will try to minimize the data movement. Also for some > + register classes bigger modes might be invalid, > + e.g. DImode for AREG on x86. For such cases the > + register move cost will be maximal. */ > + mode = ALLOCNO_MODE (cp->second); > + > cost = (cp->second == allocno > ? ira_register_move_cost[mode][rclass][aclass] > : ira_register_move_cost[mode][aclass][rclass]); > @@ -1512,7 +1522,7 @@ update_conflict_hard_regno_costs (int *c > index = ira_class_hard_reg_index[aclass][hard_regno]; > if (index < 0) > continue; > - cost = (int) ((unsigned) conflict_costs [i] * mult) / div; > + cost = (int) (((long) conflict_costs [i] * mult) / div);
If you want something wider than unsigned, wouldn't it be better to use HOST_WIDE_INT then? Otherwise it will work differently between 32-bit and 64-bit hosts. Can any of those 3 values be negative? If not, perhaps unsigned HOST_WIDE_INT? Jakub