On Thu, Feb 7, 2013 at 5:07 PM, Georg-Johann Lay <a...@gjlay.de> wrote: > This patch solves a problem with VIEW_CONVERT_EXPR folding for fixed_cst and > that use fixed-value.c:fixed_from_double_int. > > The patch sign/zero extends the double_int input according to the requested > fixed-point mode. > > The patch bootstraps on x86-linux-gnu and passes testsuite on avr-unknown one. > > Without this patch, the new test case fails because when a SAmode is > constructed in fold-const.c:native_interpret_fixed(), the MSBs are not set > according to the sign of the value. > > However, functions dealing with fixed-point constants use all bits of the > underlying double_int, not only those covered by the mode mask. > > Moreover, some sanity checking is added for to the incoming machine mode. > > Ok for trunk?
So bits not within the mode-size of FIXED_VALUE_TYPEs mode are not ignored but required to be sign-/zero-extended. As it is using double-ints as representation that might make sense. Thus ok. Thanks, Richard. > gcc/ > PR tree-optimization/56064 > * fixed-value.c (fixed_from_double_int): Sign/zero extend payload > bits according to mode. > * fixed-value.h (fixed_from_double_int) > (const_fixed_from_double_int): Adjust comments. > > gcc/testsuite/ > PR tree-optimization/56064 > * gcc.dg/fixed-point/view-convert-2.c: New test. > >