This is the mail archive of the gcc@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]

Wrong REG_UNUSED notes for PARALLEL insns?


Suppose the following insn from avr.md:


(define_insn "xload_<mode>_libgcc"
  [(set (reg:MOVMODE 22)
        (mem:MOVMODE (lo_sum:PSI (reg:QI 21)
                                 (reg:HI REG_Z))))
   (clobber (reg:QI 21))
   (clobber (reg:HI REG_Z))]
  "avr_xload_libgcc_p (<MODE>mode)"
  {
    rtx x_bytes = GEN_INT (GET_MODE_SIZE (<MODE>mode));

    output_asm_insn ("%~call __xload_%0", &x_bytes);
    return "";
  }
  [(set_attr "type" "xcall")
   (set_attr "cc" "clobber")])

and used by some code. In the -S -dP output, there is

 ; (insn 13 12 8 (parallel [
 ;             (set (reg:SI 22 r22)
 ;                 (mem:SI (lo_sum:PSI (reg:QI 21 r21)
 ;                         (reg:HI 30 r30)) [0 S4 A8 AS7]))
 ;             (clobber (reg:QI 21 r21))
 ;             (clobber (reg:HI 30 r30))
 ;         ]) movmem.c:42 15 {xload_si_libgcc}
 ;      (expr_list:REG_DEAD (reg:QI 21 r21)
 ;         (expr_list:REG_DEAD (reg:QI 31 r31)
 ;             (expr_list:REG_UNUSED (reg:QI 21 r21)
 ;                 (expr_list:REG_UNUSED (reg:HI 30 r30)
 ;                     (nil))))))
	rcall __xload_4	 ;  13	xload_si_libgcc	[length = 1]

Notice the REG_UNUSED for R21 and R30 which are wrong.

As far as I understand PARALLEL, its elements operate parallel in time, i.e. a
clobber takes place *after* the elements' actions whereas use resp. input
operand indicate that respective operands are used.

R21 and R30 are obviously used as input operands the the MEM.
The surrounding code is correct, e.g. setting R21 is not optimized away.
However, I am worried that in other context the wrong notes might lead to wrong
code.

Thanks for any hints on this.

Johann


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