diff options
author | jfc <jfc@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-22 12:57:04 +0000 |
---|---|---|
committer | jfc <jfc@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-22 12:57:04 +0000 |
commit | a0d52dee6fb09feb896b7dc4cff35a4fdbb66eaf (patch) | |
tree | 37289efcae710e9b3892cb4a63490d76a9c2b2c7 /gcc/emit-rtl.c | |
parent | 650ebf2fef63862bca691a6e0f578b54e8ccbf2f (diff) | |
download | gcc-a0d52dee6fb09feb896b7dc4cff35a4fdbb66eaf.tar.gz |
* emit-rtl.c (gen_highpart): The high part of a CONST_INT is not zero
if HOST_BITS_PER_WIDE_INT is larger than BITS_PER_WORD.
* final.c (split_double): Sign extend both halves of a split CONST_INT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19375 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index aafc41c28eb..0516927b161 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -720,14 +720,13 @@ gen_lowpart_common (mode, x) : GEN_INT (CONST_DOUBLE_LOW (x))); else { - /* MODE must be narrower than HOST_BITS_PER_INT. */ + /* 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)); - if (((val & ((HOST_WIDE_INT) (-1) << (width - 1))) - != ((HOST_WIDE_INT) (-1) << (width - 1)))) - val &= ((HOST_WIDE_INT) 1 << width) - 1; + /* Sign extend to HOST_WIDE_INT. */ + val = val << (HOST_BITS_PER_WIDE_INT - width) >> (HOST_BITS_PER_WIDE_INT - width); return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x : GEN_INT (val)); @@ -984,7 +983,11 @@ gen_highpart (mode, x) ) return GEN_INT (CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode)); else if (GET_CODE (x) == CONST_INT) - return const0_rtx; + { + if (HOST_BITS_PER_WIDE_INT <= BITS_PER_WORD) + return const0_rtx; + return GEN_INT (INTVAL (x) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD)); + } else if (GET_CODE (x) == MEM) { register int offset = 0; |