public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Committed: Fix PR target/26515, missing check in peephole pattern conditional
@ 2009-10-12 18:11 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2009-10-12 18:11 UTC (permalink / raw)
  To: gcc-patches

A missing conditional in one of the peephole patterns.
Committed to 4.3, 4.4 and trunk after testing cross to cris-elf
(the 4.3 patch is s/CRIS_CONST/CONST/g).  N.B.: neither the
test-case nor any of the original preprocessed PR attachments
trig on 4.3 and trunk.  This test-case was chosen because it was
independent of -fpic, however, it requires -march=v10 (needs
more than one special-register to introduce the need to move
between them).

gcc:
	PR target/26515
	* config/cris/cris.md (andu): Check that operand 1 is one of the
	general registers.  Fix typo in head comment.

gcc/testsuite:

	PR target/26515
	* gcc.dg/torture/pr26515.c: New test.

Index: config/cris/cris.md
===================================================================
--- config/cris/cris.md	(revision 152674)
+++ config/cris/cris.md	(working copy)
@@ -4936,7 +4936,7 @@
 ;; It should be:
 ;;   movu.b some_byte,reg_32
 ;;   and.b const,reg_32
-;; but is turns into:
+;; but it turns into:
 ;;   move.b some_byte,reg_32
 ;;   and.d const,reg_32
 ;; Fix it here.
@@ -4953,7 +4953,9 @@
   "REGNO (operands[2]) == REGNO (operands[0])
    && INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
    && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'I')
-   && !side_effects_p (operands[1])"
+   && !side_effects_p (operands[1])
+   && (!REG_P (operands[1])
+       || REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
   ;; FIXME: CC0 valid except for M (i.e. CC_NOT_NEGATIVE).
   [(set (match_dup 0) (match_dup 4))
    (set (match_dup 5) (match_dup 6))]

Index: gcc.dg/torture/pr26515.c
===================================================================
--- gcc.dg/torture/pr26515.c	(revision 0)
+++ gcc.dg/torture/pr26515.c	(revision 0)
@@ -0,0 +1,27 @@
+/* { dg-options "-march=v10" { target cris*-*-* } } */
+struct i
+{
+  long long i_size;
+  struct a *i_mapping;
+};
+struct p
+{
+  struct a *mapping;
+  long index;
+};
+extern void b (struct p*, unsigned);
+extern void u (struct p*);
+void
+block_page_mkwrite (struct i *i, struct p *p)
+{
+  unsigned end = 0;
+  long long size = 0;
+  size = i->i_size;
+  if ((p->mapping != i->i_mapping))
+    goto out_unlock;
+  if (((p->index + 1) << 13) > size)
+    end = size & ~(~(((1UL) << 13) - 1));
+  b (p, end);
+out_unlock:
+  u (p);
+}

brgds, H-P

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-12 18:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 18:11 Committed: Fix PR target/26515, missing check in peephole pattern conditional Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).