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]

Re: Questions about peephole2


On Wed, Apr 17, 2002 at 04:22:08PM -0400, Peter Barada wrote:
> 	fmove.d (%a1),%fp1	| 36	movdf_v4e/1
> 	fadd.d %fp1,%fp0	| 20	adddf3_v4e
[..]
> Insn 36 could be folded into insn 20 if it is known that %fp1 dies at
> the end of instruction 20, producing the code:

If adddf3_v4e ought to match here, I encourage you *not* to add random
peepholes here to work around a failing in the register allocator.

Instead, help with the new register allocator implementation on
new-regalloc-branch.


> (define_peephole2
>   [(set (match_operand:DF 0 "register_operand" "")
>         (mem:DF (match_operand:SI 1 "register_operand" "")))
>    (set (match_operand:DF 2 "register_operand" "")
>         (plus:DF (match_dup 2)
>                  (match_dup 0)))]
>   "find_regno_note (insn, REG_DEAD, REGNO (operands[0]))

	peep2_reg_dead_p (2, operands[0])

>    && (REGNO (operands[0]) >= 16 && REGNO (operands[0]) < 24)
>    && (REGNO (operands[1]) >= 8 && REGNO (operands[1]) < 16)
>    && (REGNO (operands[2]) >= 16 && REGNO (operands[2]) < 24)"

I encourage you to use predicates above such as

  m68k_address_register_operand

etc.  It's much much clearer.


r~


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