public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* alpha himode reload problem
@ 1997-10-19 22:24 Richard Henderson
  1997-10-22 19:01 ` Jim Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 1997-10-19 22:24 UTC (permalink / raw)
  To: egcs, gcc2

The following program generates bogus rtl in reload on an Alpha:

   struct asdf {
     int space;
     short x;
   };
   
   struct asdf * blah();
   void foo(a,b,c,d,e,f,g)
      int a,b,c,d,e,f,g;
   {
     struct asdf *x = blah();
     while (a < b)
       bar(a++,b,c,d,e,f,g);
     asm volatile("# %0" : : "r"(x->x));
   }

The output from reload is

   (insn 85 69 86 (set (reg:DI 2 $2)
           (mem:DI (plus:DI (reg:DI 30 $30)
                   (const_int 80)))) 252 {movdi-1} (nil)
       (nil))
   
   (insn 86 85 87 (set (reg:SI 2 $2)
           (mem/s:SI (plus:DI (mem:DI (plus:DI (reg:DI 30 $30)
                           (const_int 80)))
                   (const_int 4)))) 244 {movdf+1} (nil)
       (nil))
   
   (insn 87 86 71 (set (subreg:DI (reg:HI 2 $2) 0)
           (zero_extract:DI (subreg:DI (reg:SI 2 $2) 0)
               (const_int 16)
               (const_int 0))) 78 {unaligned_extendhidi+1} (nil)
       (nil))

with the bogosity of course being in insn 86.

The problem seems to me with the fact that reload records replacement
addresses within the rtl, rather than substituting on a pattern; ref
reload.c 3713 (find_reloads):

  /* If this insn pattern contains any MATCH_DUP's, make sure that
     they will be substituted if the operands they match are substituted.
     Also do now any substitutions we already did on the operands.

and alpha.md 4179 (movhi):

      if (aligned_memory_operand (operands[1], HImode))
        {
          rtx aligned_mem, bitnum;
          rtx scratch = (reload_in_progress
                         ? gen_rtx (REG, SImode, REGNO (operands[0]))
                         : gen_reg_rtx (SImode));

          get_aligned_mem (operands[1], &aligned_mem, &bitnum);

          emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
                                         scratch));
        }

The movhi pattern itself contains no match_dup, so no additional 
replacements are generated.

Any ideas on how to handle this?


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-10-27 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-19 22:24 alpha himode reload problem Richard Henderson
1997-10-22 19:01 ` Jim Wilson
1997-10-23 23:41   ` Richard Henderson
1997-10-26 16:06   ` Richard Henderson
1997-10-26 22:47     ` Richard Henderson
1997-10-27 20:25     ` Jim Wilson

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).