aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <michael.meissner@amd.com>2007-12-10 23:49:32 +0000
committerMichael Meissner <michael.meissner@amd.com>2007-12-10 23:49:32 +0000
commita8a3d1f8f218b0afc9714f591701e1f5d5429bf8 (patch)
tree15f6d3b742443d3fdb182abce1d50dc28527853e
parentc9bd41c442e31d35c3b1a9d33c2e6484ce077b48 (diff)
Merge up to revision 130757ix86/gcc-4_1-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ix86/gcc-4_1-branch@130761 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/ChangeLog-ix868
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/fold-const.c39
-rw-r--r--gcc/testsuite/ChangeLog13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr34030.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr34130.c12
-rw-r--r--svn-mergepoint2
8 files changed, 79 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 88880289bab..004fe65d805 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2007-11-29 Matthias Klose <doko@ubuntu.com>
+
+ Backport from mainline:
+ 2007-11-17 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/34130
+ * fold-const.c (extract_muldiv_1): Do not move negative
+ constants inside ABS_EXPR.
+
+2007-11-16 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/34030
+ * fold-const.c (fold_binary): Use correct types for folding
+ 1 << X & Y to Y >> X & 1.
+
2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
PR rtl-optimization/33822
diff --git a/gcc/ChangeLog-ix86 b/gcc/ChangeLog-ix86
index 777a5ef6bc9..20c7abc732f 100644
--- a/gcc/ChangeLog-ix86
+++ b/gcc/ChangeLog-ix86
@@ -1,3 +1,11 @@
+2007-12-10 Michael Meissner <michael.meissner@amd.com>
+
+ merge up to revision 130757.
+
+2007-11-26 Michael Meissner <michael.meissner@amd.com>
+
+ merge up to revision 130447.
+
2007-11-09 Michael Meissner <michael.meissner@amd.com>
merge up to revision 130144.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c844d09af31..30a98ca3ef0 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20071113
+20071210
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ec9ab9486e0..f9e58d27591 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5340,6 +5340,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type)
}
break;
}
+ /* If the constant is negative, we cannot simplify this. */
+ if (tree_int_cst_sgn (c) == -1)
+ break;
/* FALLTHROUGH */
case NEGATE_EXPR:
if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0)
@@ -9566,24 +9569,24 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
tree arg01 = TREE_OPERAND (arg0, 1);
if (TREE_CODE (arg00) == LSHIFT_EXPR
&& integer_onep (TREE_OPERAND (arg00, 0)))
- return
- fold_build2 (code, type,
- build2 (BIT_AND_EXPR, TREE_TYPE (arg0),
- build2 (RSHIFT_EXPR, TREE_TYPE (arg00),
- arg01, TREE_OPERAND (arg00, 1)),
- fold_convert (TREE_TYPE (arg0),
- integer_one_node)),
- arg1);
- else if (TREE_CODE (TREE_OPERAND (arg0, 1)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (arg0, 1), 0)))
- return
- fold_build2 (code, type,
- build2 (BIT_AND_EXPR, TREE_TYPE (arg0),
- build2 (RSHIFT_EXPR, TREE_TYPE (arg01),
- arg00, TREE_OPERAND (arg01, 1)),
- fold_convert (TREE_TYPE (arg0),
- integer_one_node)),
- arg1);
+ {
+ tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg00),
+ arg01, TREE_OPERAND (arg00, 1));
+ tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
+ build_int_cst (TREE_TYPE (arg0), 1));
+ return fold_build2 (code, type,
+ fold_convert (TREE_TYPE (arg1), tem), arg1);
+ }
+ else if (TREE_CODE (arg01) == LSHIFT_EXPR
+ && integer_onep (TREE_OPERAND (arg01, 0)))
+ {
+ tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg01),
+ arg00, TREE_OPERAND (arg01, 1));
+ tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
+ build_int_cst (TREE_TYPE (arg0), 1));
+ return fold_build2 (code, type,
+ fold_convert (TREE_TYPE (arg1), tem), arg1);
+ }
}
/* If this is an NE or EQ comparison of zero against the result of a
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4183bad7efd..7b78678753e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2007-11-29 Matthias Klose <doko@ubuntu.com>
+
+ Backport from mainline:
+ 2007-11-17 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/34130
+ * gcc.c-torture/execute/pr34130.c: New testcase.
+
+2007-11-16 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/34030
+ * gcc.c-torture/compile/pr34030.c: New testcase.
+
2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/out-of-bounds-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34030.c b/gcc/testsuite/gcc.c-torture/compile/pr34030.c
new file mode 100644
index 00000000000..f4f9e176d3f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr34030.c
@@ -0,0 +1,8 @@
+int myvar;
+
+int foo(int mynum)
+{
+ if ((((void *)0) == (myvar & ((1U<<0) << mynum))) && (mynum > 0))
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34130.c b/gcc/testsuite/gcc.c-torture/execute/pr34130.c
new file mode 100644
index 00000000000..b528ff22b8a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr34130.c
@@ -0,0 +1,12 @@
+extern void abort (void);
+int foo (int i)
+{
+ return -2 * __builtin_abs(i - 2);
+}
+int main()
+{
+ if (foo(1) != -2
+ || foo(3) != -2)
+ abort ();
+ return 0;
+}
diff --git a/svn-mergepoint b/svn-mergepoint
index f3dc5866500..c95b85b1d5c 100644
--- a/svn-mergepoint
+++ b/svn-mergepoint
@@ -1 +1 @@
-130044
+130757