aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-18 01:13:29 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-12-18 01:13:29 +0100
commitdc7c279e97760bba05fa4d637d5652f8559eab3a (patch)
tree8b72d93c5aed08c343fa4fbc730ba4c7f0b0b5bc /gcc/simplify-rtx.c
parent44f37984f4e87411999989e2c3ff715a4860d9c3 (diff)
downloadgcc-dc7c279e97760bba05fa4d637d5652f8559eab3a.zip
gcc-dc7c279e97760bba05fa4d637d5652f8559eab3a.tar.gz
gcc-dc7c279e97760bba05fa4d637d5652f8559eab3a.tar.bz2
re PR rtl-optimization/34490 (r128833 causes miscompilation of glibc clock_gettime.c)
PR rtl-optimization/34490 * simplify-rtx.c (simplify_const_relational_operation): If !sign, don't reduce mmin/mmax using num_sign_bit_copies. * gcc.c-torture/execute/20071216-1.c: New test. From-SVN: r131023
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 0371339..fd14e40 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -4233,15 +4233,17 @@ simplify_const_relational_operation (enum rtx_code code,
else
{
rtx mmin_rtx, mmax_rtx;
- unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
get_mode_bounds (mode, sign, mode, &mmin_rtx, &mmax_rtx);
- /* Since unsigned mmin will never be interpreted as negative, use
- INTVAL (and an arithmetic right shift). */
- mmin = INTVAL (mmin_rtx) >> (sign_copies - 1);
- /* Since signed mmax will always be positive, use UINTVAL (and
- a logical right shift). */
- mmax = UINTVAL (mmax_rtx) >> (sign_copies - 1);
+ mmin = INTVAL (mmin_rtx);
+ mmax = INTVAL (mmax_rtx);
+ if (sign)
+ {
+ unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
+
+ mmin >>= (sign_copies - 1);
+ mmax >>= (sign_copies - 1);
+ }
}
switch (code)