diff options
author | Roger Sayle <sayle@gcc.gnu.org> | 2006-03-03 05:55:02 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-03-03 05:55:02 +0000 |
commit | 0f2f71b552e7c1136401c3b7c7d8a28d92aed1bc (patch) | |
tree | 141afc731966bde556ecd0d21f0b4225099403fd /gcc/simplify-rtx.c | |
parent | e20f951129228f1decc51b4dfe5609cb55806b2a (diff) | |
download | gcc-0f2f71b552e7c1136401c3b7c7d8a28d92aed1bc.zip gcc-0f2f71b552e7c1136401c3b7c7d8a28d92aed1bc.tar.gz gcc-0f2f71b552e7c1136401c3b7c7d8a28d92aed1bc.tar.bz2 |
simplify-rtx.c (simplify_unary_operation): When simplifying (neg (lt X 0)) into (ashiftrt X C) or (lshiftrt X C)...
* simplify-rtx.c (simplify_unary_operation): When simplifying
(neg (lt X 0)) into (ashiftrt X C) or (lshiftrt X C), make sure
that we perform the right shift in the appropriate mode, and
then extend or truncate the result to requested mode.
From-SVN: r111671
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index aded68e..754464d 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -590,12 +590,28 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op) if (GET_CODE (op) == LT && XEXP (op, 1) == const0_rtx) { + enum machine_mode inner = GET_MODE (XEXP (op, 0)); + int isize = GET_MODE_BITSIZE (inner); if (STORE_FLAG_VALUE == 1) - return simplify_gen_binary (ASHIFTRT, mode, XEXP (op, 0), - GEN_INT (GET_MODE_BITSIZE (mode) - 1)); + { + temp = simplify_gen_binary (ASHIFTRT, inner, XEXP (op, 0), + GEN_INT (isize - 1)); + if (mode == inner) + return temp; + if (GET_MODE_BITSIZE (mode) > isize) + return simplify_gen_unary (SIGN_EXTEND, mode, temp, inner); + return simplify_gen_unary (TRUNCATE, mode, temp, inner); + } else if (STORE_FLAG_VALUE == -1) - return simplify_gen_binary (LSHIFTRT, mode, XEXP (op, 0), - GEN_INT (GET_MODE_BITSIZE (mode) - 1)); + { + temp = simplify_gen_binary (LSHIFTRT, inner, XEXP (op, 0), + GEN_INT (isize - 1)); + if (mode == inner) + return temp; + if (GET_MODE_BITSIZE (mode) > isize) + return simplify_gen_unary (ZERO_EXTEND, mode, temp, inner); + return simplify_gen_unary (TRUNCATE, mode, temp, inner); + } } break; |