PR target/52086
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2012 09:04:57 +0000 (09:04 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2012 09:04:57 +0000 (09:04 +0000)
* 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

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr52086.c [new file with mode: 0644]

index 26beb11..055e97e 100644 (file)
@@ -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.
index 286088f..6e2c123 100644 (file)
@@ -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
    && 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
index a6f4fc2..bad0b70 100644 (file)
@@ -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 (file)
index 0000000..a12e1ce
--- /dev/null
@@ -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 ();
+    }
+}