Hi Jeff,

I'm looking at the remaining text peepholes (define_peephole instead
of define_peephole2) and I have a few questions about mn10300, that
you are a maintainer of.
The first peephole is this:

;; Try to combine consecutive updates of the stack pointer (or any
;; other register for that matter).
(define_peephole
  [(set (match_operand:SI 0 "register_operand" "=dxay")
        (plus:SI (match_dup 0)
                 (match_operand 1 "const_int_operand" "")))
   (set (match_dup 0)
        (plus:SI (match_dup 0)
                 (match_operand 2 "const_int_operand" "")))]
  ""
  "*
{
  operands[1] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[1]));
  return \"add %1,%0\";
}"
  [(set_attr "cc" "clobber")])

It seems to me that we have the CSA pass for this
(combine-stack-adj.c). Maybe not for the "or any other register" part,
but that should never happen anyway, or one of the CSE passes has not
done its job properly. The peephole appears to pre-date the CSA pass.
I would like to eliminate this define_peephole. Do you agree? If so,
what would be sufficient testing for you to accept a patch that
removes this peephole?


The second question is about the remaining define_peepholes, that all
look more-or-less alike. Here is the first one:

(define_peephole
  [(set (cc0) (compare (match_operand:SI 0 "register_operand" "dx")
                       (const_int 0)))
   (set (pc) (if_then_else (ge (cc0) (const_int 0))
                           (match_operand 1 "" "")
                           (pc)))]
  "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
  "add %0,%0\;bcc %1"
  [(set_attr "cc" "clobber")])


As far as I understand, the REG_OK_FOR_INDEX_P check is redundant:

* The constraints "dx" require a data register or an extended register

* REG_OK_FOR_INDEX_P(X) during peephoel is equivalent to
REGNO_STRICT_OK_FOR_INDEX_P(X,REG_STRICT)
* REGNO_STRICT_OK_FOR_INDEX_P requires REGNO_DATA_P or REGNO_EXTENDED_P.

So the constrains should already make sure that REG_OK_FOR_INDEX_P is valid.
Am I missing something?

I would like to convert these remaining define_peepholes to
define_peephole2s instead. However, I can't find a define_insn that
produces the bcs or bcc instructions. Could use a little help figuring
out what insn I should generate in the peephole2.

Thanks for any help you can give,

Ciao!
Steven

Reply via email to