aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2005-04-10 06:27:12 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2005-04-10 06:27:12 +0000
commitecf9c079e2cf0d25a88746512fa491018a056c24 (patch)
treea9a24b1030863f3808ef6e7469755b503a3c1c5a
parentf1ac52cd09a623f1f6f9894b10b0cf5337d8491b (diff)
downloadgcc-ecf9c079e2cf0d25a88746512fa491018a056c24.zip
gcc-ecf9c079e2cf0d25a88746512fa491018a056c24.tar.gz
gcc-ecf9c079e2cf0d25a88746512fa491018a056c24.tar.bz2
combine.c (combine_simplify_rtx): Remove a transformation that relies on an invalid assumption about rtl...
* combine.c (combine_simplify_rtx): Remove a transformation that relies on an invalid assumption about rtl sign-extension semantics. From-SVN: r97941
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/combine.c41
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20050410-1.c13
4 files changed, 22 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8cb7b42..bd836f3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2005-04-10 Richard Sandiford <rsandifo@redhat.com>
+ * combine.c (combine_simplify_rtx): Remove a transformation that
+ relies on an invalid assumption about rtl sign-extension semantics.
+
+2005-04-10 Richard Sandiford <rsandifo@redhat.com>
+
* value-prof.c (tree_divmod_fixed_value_transform): Fix arguments
to build_int_cst_wide.
diff --git a/gcc/combine.c b/gcc/combine.c
index 313a3d9..89866e0 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3768,47 +3768,6 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest)
SUBST (XEXP (x, 1), temp);
}
- /* If this is a PLUS, MINUS, or MULT, and the first operand is the
- sign extension of a PLUS with a constant, reverse the order of the sign
- extension and the addition. Note that this not the same as the original
- code, but overflow is undefined for signed values. Also note that the
- PLUS will have been partially moved "inside" the sign-extension, so that
- the first operand of X will really look like:
- (ashiftrt (plus (ashift A C4) C5) C4).
- We convert this to
- (plus (ashiftrt (ashift A C4) C2) C4)
- and replace the first operand of X with that expression. Later parts
- of this function may simplify the expression further.
-
- For example, if we start with (mult (sign_extend (plus A C1)) C2),
- we swap the SIGN_EXTEND and PLUS. Later code will apply the
- distributive law to produce (plus (mult (sign_extend X) C1) C3).
-
- We do this to simplify address expressions. */
-
- if ((code == PLUS || code == MINUS || code == MULT)
- && GET_CODE (XEXP (x, 0)) == ASHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ASHIFT
- && GET_CODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1) == XEXP (XEXP (x, 0), 1)
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT
- && (temp = simplify_binary_operation (ASHIFTRT, mode,
- XEXP (XEXP (XEXP (x, 0), 0), 1),
- XEXP (XEXP (x, 0), 1))) != 0)
- {
- rtx new
- = simplify_shift_const (NULL_RTX, ASHIFT, mode,
- XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0),
- INTVAL (XEXP (XEXP (x, 0), 1)));
-
- new = simplify_shift_const (NULL_RTX, ASHIFTRT, mode, new,
- INTVAL (XEXP (XEXP (x, 0), 1)));
-
- SUBST (XEXP (x, 0), simplify_gen_binary (PLUS, mode, new, temp));
- }
-
/* If this is a simple operation applied to an IF_THEN_ELSE, try
applying it to the arms of the IF_THEN_ELSE. This often simplifies
things. Check for cases where both arms are testing the same
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fea25c4..59255c0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-10 Richard Sandiford <rsandifo@redhat.com>
+
+ * gcc.c-torture/execute/20050410-1.c: New test.
+
2005-04-09 Alexandre Oliva <aoliva@redhat.com>
* gcc.dg/pr20126.c: New.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050410-1.c b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c
new file mode 100644
index 0000000..c4cd852
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c
@@ -0,0 +1,13 @@
+int s = 200;
+int __attribute__((noinline))
+foo (void)
+{
+ return (signed char) (s - 100) - 5;
+}
+int
+main (void)
+{
+ if (foo () != 95)
+ abort ();
+ exit (0);
+}