* emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.
authorRichard Henderson <rth@cygnus.com>
Sun, 24 Sep 2000 23:46:46 +0000 (16:46 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 24 Sep 2000 23:46:46 +0000 (16:46 -0700)
From-SVN: r36595

gcc/ChangeLog
gcc/emit-rtl.c

index ee92e03..7507986 100644 (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
index 2b90717..ac5e965 100644 (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));