summaryrefslogtreecommitdiff
path: root/gcc/c-convert.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1992-09-09 06:56:35 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1992-09-09 06:56:35 +0000
commit350838adc56260daa813ce4371e60f67d625c9a0 (patch)
treebec7c424c0de2b6767359141ab50160cbaedab45 /gcc/c-convert.c
parent72f119501b132815483d6f190b5d2935afca3033 (diff)
downloadgcc-350838adc56260daa813ce4371e60f67d625c9a0.tar.gz
(convert_to_integer): When optimizing LSHIFT_EXPR and
RSHIFT_EXPR, do compares at tree level. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@2086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-convert.c')
-rw-r--r--gcc/c-convert.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index afc3ad1dfc9..b160fd1b1ac 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -177,20 +177,20 @@ convert_to_integer (type, expr)
{
case RSHIFT_EXPR:
/* We can pass truncation down through right shifting
- when the shift count is a negative constant. */
- if (TREE_CODE (TREE_OPERAND (expr, 1)) != INTEGER_CST
- || TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)) > 0)
- break;
- goto trunc1;
+ when the shift count is a nonpositive constant. */
+ if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
+ && tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_one_node))
+ goto trunc1;
+ break;
case LSHIFT_EXPR:
/* We can pass truncation down through left shifting
- when the shift count is a positive constant. */
- if (TREE_CODE (TREE_OPERAND (expr, 1)) != INTEGER_CST
- || TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)) < 0)
- break;
- /* In this case, shifting is like multiplication. */
- goto trunc1;
+ when the shift count is a nonnegative constant. */
+ if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
+ && ! tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_zero_node))
+ /* In this case, shifting is like multiplication. */
+ goto trunc1;
+ break;
case MAX_EXPR:
case MIN_EXPR: