aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-07-22 18:21:31 -0700
committerRichard Henderson <rth@gcc.gnu.org>1999-07-22 18:21:31 -0700
commit7e4ce834b2867f4c7bb2b44e434f5d2778e23ca3 (patch)
treedcae196cb9448ce862621b3d77db8a0bae222ce2 /gcc/cse.c
parent27b8d0cd535f663df34c8264ee48e3034a663c38 (diff)
downloadgcc-7e4ce834b2867f4c7bb2b44e434f5d2778e23ca3.zip
gcc-7e4ce834b2867f4c7bb2b44e434f5d2778e23ca3.tar.gz
gcc-7e4ce834b2867f4c7bb2b44e434f5d2778e23ca3.tar.bz2
explow.c (trunc_int_for_mode): New function.
* explow.c (trunc_int_for_mode): New function. (plus_constant_wide): Use it. * combine.c (simplify_and_const_int): Likewise. (merge_outer_ops): Likewise. (simplify_shift_const): Likewise. * cse.c (simplify_unary_operation): Likewise. (simplify_binary_operation): Likewise. * emit-rtl.c (operand_subword): Likewise. * rtl.h: Declare it. From-SVN: r28222
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c65
1 files changed, 3 insertions, 62 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 605d185..edd434b 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3364,27 +3364,7 @@ simplify_unary_operation (code, mode, op, op_mode)
abort ();
}
- /* 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. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= ((HOST_WIDE_INT) (-1) << width);
+ val = trunc_int_for_mode (val, mode);
return GEN_INT (val);
}
@@ -3556,27 +3536,7 @@ simplify_unary_operation (code, mode, op, op_mode)
set_float_handler (NULL_PTR);
- /* 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. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= ((HOST_WIDE_INT) (-1) << width);
+ val = trunc_int_for_mode (val, mode);
return GEN_INT (val);
}
@@ -4458,26 +4418,7 @@ simplify_binary_operation (code, mode, op0, op1)
abort ();
}
- /* 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. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= ((HOST_WIDE_INT) (-1) << width);
+ val = trunc_int_for_mode (val, mode);
return GEN_INT (val);
}