summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/gcc/gcc/combine.c21
-rw-r--r--gnu/usr.bin/gcc/gcc/config/mips/openbsd.h3
2 files changed, 14 insertions, 10 deletions
diff --git a/gnu/usr.bin/gcc/gcc/combine.c b/gnu/usr.bin/gcc/gcc/combine.c
index 3d113915f65..29142b7d2fc 100644
--- a/gnu/usr.bin/gcc/gcc/combine.c
+++ b/gnu/usr.bin/gcc/gcc/combine.c
@@ -9737,17 +9737,20 @@ simplify_shift_const (x, code, result_mode, varop, orig_count)
/* If we can't do that, try to simplify the shift in each arm of the
logical expression, make a new logical expression, and apply
the inverse distributive law. */
- {
- rtx lhs = simplify_shift_const (NULL_RTX, code, shift_mode,
- XEXP (varop, 0), count);
- rtx rhs = simplify_shift_const (NULL_RTX, code, shift_mode,
- XEXP (varop, 1), count);
+#ifdef BROKEN_SIMPLIFY_SHIFT_CONST_P
+ if (GET_CODE (XEXP (varop, 1)) == CONST_INT)
+#endif
+ {
+ rtx lhs = simplify_shift_const (NULL_RTX, code, shift_mode,
+ XEXP (varop, 0), count);
+ rtx rhs = simplify_shift_const (NULL_RTX, code, shift_mode,
+ XEXP (varop, 1), count);
- varop = gen_binary (GET_CODE (varop), shift_mode, lhs, rhs);
- varop = apply_distributive_law (varop);
+ varop = gen_binary (GET_CODE (varop), shift_mode, lhs, rhs);
+ varop = apply_distributive_law (varop);
- count = 0;
- }
+ count = 0;
+ }
break;
case EQ:
diff --git a/gnu/usr.bin/gcc/gcc/config/mips/openbsd.h b/gnu/usr.bin/gcc/gcc/config/mips/openbsd.h
index 36fa6c6402b..cdb3c003f76 100644
--- a/gnu/usr.bin/gcc/gcc/config/mips/openbsd.h
+++ b/gnu/usr.bin/gcc/gcc/config/mips/openbsd.h
@@ -136,4 +136,5 @@ Boston, MA 02111-1307, USA. */
#undef MIPS_DEFAULT_GVALUE
#define MIPS_DEFAULT_GVALUE 0
-
+/* Prevent too much recursion in simplify_shift_const(). */
+#define BROKEN_SIMPLIFY_SHIFT_CONST_P