summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-28 19:02:36 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-28 19:02:36 +0000
commitff2f572b49781bc460a3648268856d528ab43fdf (patch)
treed86565b08e810ddca06674286580022e183196bc /gcc/combine.c
parentaaeb7d262ecdc4bec99a7425081964d6c781609f (diff)
downloadgcc-ff2f572b49781bc460a3648268856d528ab43fdf.tar.gz
PR c/37924
* combine.c (make_compound_operation): Don't call make_extraction with non-positive length. (simplify_shift_const_1): Canonicalize count even if complement_p. * gcc.c-torture/execute/pr37924.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141413 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 55baf37149a..e76049a49ef 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6996,7 +6996,8 @@ make_compound_operation (rtx x, enum rtx_code in_code)
if (GET_CODE (rhs) == CONST_INT
&& GET_CODE (lhs) == ASHIFT
&& GET_CODE (XEXP (lhs, 1)) == CONST_INT
- && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1)))
+ && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1))
+ && INTVAL (rhs) < mode_width)
{
new_rtx = make_compound_operation (XEXP (lhs, 0), next_code);
new_rtx = make_extraction (mode, new_rtx,
@@ -7016,6 +7017,7 @@ make_compound_operation (rtx x, enum rtx_code in_code)
&& (OBJECT_P (SUBREG_REG (lhs))))
&& GET_CODE (rhs) == CONST_INT
&& INTVAL (rhs) < HOST_BITS_PER_WIDE_INT
+ && INTVAL (rhs) < mode_width
&& (new_rtx = extract_left_shift (lhs, INTVAL (rhs))) != 0)
new_rtx = make_extraction (mode, make_compound_operation (new_rtx, next_code),
0, NULL_RTX, mode_width - INTVAL (rhs),
@@ -9003,11 +9005,6 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
if (GET_CODE (varop) == CLOBBER)
return NULL_RTX;
- /* If we discovered we had to complement VAROP, leave. Making a NOT
- here would cause an infinite loop. */
- if (complement_p)
- break;
-
/* Convert ROTATERT to ROTATE. */
if (code == ROTATERT)
{
@@ -9053,6 +9050,11 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
}
}
+ /* If we discovered we had to complement VAROP, leave. Making a NOT
+ here would cause an infinite loop. */
+ if (complement_p)
+ break;
+
/* An arithmetic right shift of a quantity known to be -1 or 0
is a no-op. */
if (code == ASHIFTRT