* emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.

From-SVN: r36595
This commit is contained in:
Richard Henderson 2000-09-24 16:46:46 -07:00 committed by Richard Henderson
parent c06aa51eb9
commit e1389cac8d
2 changed files with 6 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2000-09-24 Richard Henderson <rth@cygnus.com>
* emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.
2000-09-24 Mark Mitchell <mark@codesourcery.com>
* c-tree.texi: Moved here from cp/ir.texi. Documented nested

View File

@ -767,11 +767,7 @@ gen_lowpart_common (mode, x)
{
/* If MODE is twice the host word size, X is already the desired
representation. Otherwise, if MODE is wider than a word, we can't
do this. If MODE is exactly a word, return just one CONST_INT.
If MODE is smaller than a word, clear the bits that don't belong
in our mode, unless they and our sign bit are all one. So we get
either a reasonable negative value or a reasonable unsigned value
for this mode. */
do this. If MODE is exactly a word, return just one CONST_INT. */
if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT)
return x;
@ -783,12 +779,11 @@ gen_lowpart_common (mode, x)
else
{
/* MODE must be narrower than HOST_BITS_PER_WIDE_INT. */
int width = GET_MODE_BITSIZE (mode);
HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
: CONST_DOUBLE_LOW (x));
/* Sign extend to HOST_WIDE_INT. */
val = val << (HOST_BITS_PER_WIDE_INT - width) >> (HOST_BITS_PER_WIDE_INT - width);
val = trunc_int_for_mode (val, mode);
return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
: GEN_INT (val));