summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-02 09:04:57 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-02 09:04:57 +0000
commit80b67e55d6cbd8abbe5dbb0087eeea0dc3c27941 (patch)
tree92c9b3206689c92f9d9f399ae8e148476cabef1b
parentddee24bb52316286952bdfe9931038623abc7def (diff)
downloadgcc-80b67e55d6cbd8abbe5dbb0087eeea0dc3c27941.tar.gz
PR target/52086
* config/i386/i386.md (*addqi_2 peephole with SImode addition): Check that operands[2] is either immediate, or q_regs_operand. * gcc.dg/pr52086.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183830 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/i386/i386.md5
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr52086.c21
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 26beb117439..055e97e4f93 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2012-02-02 Jakub Jelinek <jakub@redhat.com>
+ PR target/52086
+ * config/i386/i386.md (*addqi_2 peephole with SImode addition): Check
+ that operands[2] is either immediate, or q_regs_operand.
+
PR tree-optimization/52073
* tree-vect-stmts.c (vect_mark_relevant): When checking uses of
a pattern stmt for pattern uses, ignore uses outside of the loop.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 286088f23b2..6e2c1230de3 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1,6 +1,6 @@
;; GCC machine description for IA-32 and x86-64.
;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
;; Free Software Foundation, Inc.
;; Mostly by William Schelter.
;; x86_64 support added by Jan Hubicka
@@ -17232,6 +17232,9 @@
&& REG_P (operands[0]) && REG_P (operands[4])
&& REGNO (operands[0]) == REGNO (operands[4])
&& peep2_reg_dead_p (4, operands[0])
+ && (<MODE>mode != QImode
+ || immediate_operand (operands[2], SImode)
+ || q_regs_operand (operands[2], SImode))
&& !reg_overlap_mentioned_p (operands[0], operands[1])
&& ix86_match_ccmode (peep2_next_insn (3),
(GET_CODE (operands[3]) == PLUS
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a6f4fc2d028..bad0b702bf1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-02-02 Jakub Jelinek <jakub@redhat.com>
+ PR target/52086
+ * gcc.dg/pr52086.c: New test.
+
PR tree-optimization/52073
* gcc.c-torture/compile/pr52073.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr52086.c b/gcc/testsuite/gcc.dg/pr52086.c
new file mode 100644
index 00000000000..a12e1ce7928
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52086.c
@@ -0,0 +1,21 @@
+/* PR target/52086 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+
+struct S { char a; char b[100]; };
+int bar (void);
+int baz (int);
+
+void
+foo (struct S *x)
+{
+ if (bar () & 1)
+ {
+ char c = bar ();
+ baz (4);
+ x->a += c;
+ while (x->a)
+ x->b[c] = bar ();
+ }
+}