On Mon, Jul 11, 2011 at 6:55 PM, Andrew Stubbs <a...@codesourcery.com> wrote: > On 07/07/11 10:58, Richard Guenther wrote: >> >> I think you should assume that series of widenings, >> (int)(short)char_variable >> are already combined. Thus I believe you only need to consider a single >> conversion in valid_types_for_madd_p. > > Ok, here's my new patch. > > This version only allows one conversion between the multiply and addition, > so assumes that VRP has eliminated any needless ones. > > That one conversion may either be a truncate, if the mode was too large for > the meaningful data, or an extend, which must be of the right flavour. > > This means that this patch now has the same effect as the last patch, for > all valid cases (following you VRP patch), but rejects the cases where the C > language (unhelpfully) requires an intermediate temporary to be of the > 'wrong' signedness. > > Hopefully the output will now be the same between both -O0 and -O2, and > programmers will continue to have to be careful about casting unsigned > variables whenever they expect purely unsigned math. :( > > Is this one ok?
Ok. Thanks, Richard. > Andrew >