summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-18 00:13:29 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-18 00:13:29 +0000
commita6871c1e2e7fd869b57883215b31bf82ff9ccc70 (patch)
tree8b72d93c5aed08c343fa4fbc730ba4c7f0b0b5bc /gcc/simplify-rtx.c
parentc50d786286fbd0533152672d2f15d68a3913f129 (diff)
downloadgcc-a6871c1e2e7fd869b57883215b31bf82ff9ccc70.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131023 138bc75d-0d04-0410-961f-82ee72b054a4
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 0371339d540..fd14e407dc8 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)