On Tue, 10 Feb 2015, Jeff Law wrote: > I think the way to go is to always convert the inner operands to an unsigned > type. In fact, everything except the outer convert should be using an > unsigned type of the same size/precision as @0's type. The outer convert > should, of course, be the final type. > > That avoids all the concerns about sign bit propagation from the narrow type > into the wider final type.
Subject of course to allowing for the cases where the original expression uses sign-extension (signed narrow type), the mask is consistent with this (sign bit of narrow type and all higher bits set, e.g. -128), and the operation is bitwise not arithmetic, if you want to optimize those as well. -- Joseph S. Myers jos...@codesourcery.com