This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, alpha]: Fix gcc.dg/pr33563.c failure


Hello!

The problem is that alpha_set_memflags () does not operate on an insn
sequence, although the comment says so. The result is, that only the
first insn of a sign-extend seqence is handled, producing:

;; c ={v} *p;

(insn 6 5 7 pr33653.c:6 (set (reg:DI 71)
        (plus:DI (reg/v/f:DI 70 [ p ])
            (const_int 1 [0x1]))) -1 (nil))

(insn 7 6 8 pr33653.c:6 (set (reg:DI 72)
        (mem:DI (and:DI (reg/v/f:DI 70 [ p ])
                (const_int -8 [0xfffffffffffffff8])) [0 S8 A64])) -1 (nil))

(insn 8 7 9 pr33653.c:6 (set (reg:DI 73)
        (ashift:DI (reg:DI 72)
            (minus:DI (const_int 64 [0x40])
                (ashift:DI (and:DI (reg:DI 71)
                        (const_int 7 [0x7]))
                    (const_int 3 [0x3]))))) -1 (nil))

(insn 9 8 0 pr33653.c:6 (set (reg/v:DI 69 [ c ])
        (ashiftrt:DI (reg:DI 73)
            (const_int 56 [0x38]))) -1 (expr_list:REG_EQUAL
(sign_extend:DI (mem/v:QI (reg/v/f:DI 70 [ p ]) [0 S1 A8]))
        (nil)))

Please note (insn 7), where we lost volatile flag.

Attached patch fixes this problem by teaching alpha_set_memflags() to
handle insn sequences and for the testcase produces following asm:

f:
    .frame $30,0,$26,0
    .prologue 0
    ldq_u $1,0($16)
    ret $31,($26),1
    .end f

The load was not there if the testcase was compiled with unpatched gcc.

2008-12-07 Uros Bizjak <ubizjak@gmail.com>

    * config/alpha/alpha.c (alpha_set_memflags): Process memory
    references in full insn sequence.

Patch is currently under bootstrap on ev56-linux-gnu cfarm machine. OK
if regression test passes?

Uros.

Index: alpha.c
===================================================================
--- alpha.c	(revision 142536)
+++ alpha.c	(working copy)
@@ -1610,11 +1610,11 @@
    a MEM, don't do anything.  */
 
 void
-alpha_set_memflags (rtx insn, rtx ref)
+alpha_set_memflags (rtx seq, rtx ref)
 {
-  rtx *base_ptr;
+  rtx insn;
 
-  if (GET_CODE (ref) != MEM)
+  if (!MEM_P (ref))
     return;
 
   /* This is only called from alpha.md, after having had something
@@ -1627,11 +1627,9 @@
       && !MEM_READONLY_P (ref))
     return;
 
-  if (INSN_P (insn))
-    base_ptr = &PATTERN (insn);
-  else
-    base_ptr = &insn;
-  for_each_rtx (base_ptr, alpha_set_memflags_1, (void *) ref);
+  for (insn = seq; insn; insn = NEXT_INSN (insn))
+    if (INSN_P (insn))
+      for_each_rtx (&PATTERN (insn), alpha_set_memflags_1, (void *) ref);
 }
 
 static rtx alpha_emit_set_const (rtx, enum machine_mode, HOST_WIDE_INT,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]