aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-09-24 16:46:46 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-09-24 16:46:46 -0700
commite1389cac8de5596ecf7729176e2410081e8ff288 (patch)
tree590212a97e0c307b3be377afad30ae195f1ca51e /gcc
parentc06aa51eb96d2c2de44e8a14bf722c0909dce712 (diff)
downloadgcc-e1389cac8de5596ecf7729176e2410081e8ff288.zip
gcc-e1389cac8de5596ecf7729176e2410081e8ff288.tar.gz
gcc-e1389cac8de5596ecf7729176e2410081e8ff288.tar.bz2
* emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.
From-SVN: r36595
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/emit-rtl.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ee92e03..7507986 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2b90717..ac5e965 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -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));