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]

Re: Problem in the combiner


  In message <199709091443.QAA29809@lslsun17.epfl.ch>you write:
  > I've hit a problem in the combiner, more specifically in the try_combine
  > routine.  The bug bites when one of the operands in the rtx code is
  > a hard register and one of the instructions takes a subreg of this register.
  > Consider the following instructions at the start of try_combine:
  > 
  > Breakpoint 2, try_combine (i3=0x189e18, i2=0x189db0, i1=0x189d10) at combin
  > e.c:1213
  > (gdb) call debug_rtx(i1)
  > (insn 53 50 54 (parallel[ 
  >             (set (reg:HI 3 %r1)
  >                 (mult:HI (reg:HI 37)
  >                     (const_int 4)))
  >             (clobber (reg:HI 1 %r3))
  >         ] ) 33 {*mulhi3} (nil)
  >     (expr_list:REG_DEAD (reg:HI 37)
  >         (expr_list:REG_UNUSED (reg:HI 1 %r3)
  >             (nil))))
  > (gdb) call debug_rtx(i2)
  > 
  > (insn 55 54 56 (set (reg:HI 51)
  >         (ior:HI (reg:HI 47)
  >             (reg:HI 3 %r1))) 193 {*log_ophi3} (insn_list 53 (insn_list 50 (
  > nil)))
  >     (expr_list:REG_DEAD (reg:HI 3 %r1)
  >         (nil)))
  > (gdb) call debug_rtx(i3)
  > 
  > (insn 56 55 57 (set (reg:QI 52)
  >         (and:QI (subreg:QI (reg:HI 51) 1)
  >             (const_int 7))) 192 {*com_opqi3_accu} (insn_list 55 (nil))
  >     (expr_list:REG_DEAD (reg:HI 51)
  >         (nil)))
[ ... ]


  > Notice that because i3 is using a subreg in QImode, the
  > hard register r1 in HImode has become hard register r0 in QImode.
  > That is because the (subreg:QI (reg:HI 3 %r1) 1) has been optimized
  > into (reg:QI 4 %r0) during the combination performed by subst.
  > Now the problem arises when the combiner tries to combine that new
  > pattern with i1, since it will fail to notice that
  > (subreg:QI (reg:HI 3 %r1) 1) and (reg:QI 4 %r0) are actually the same
  > thing.  The following patch tries to address this issue.
What are your predicates for the *com_opqi3_accu pattern?

Normally something like 'register_operand' is used, which would
allow the (subreg:QI (reg:HI)) to be matched just like a (reg:QI).

jeff


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