This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Whats wrong with this pattern?
Jan Hubicka wrote:
> So if I write subreg aware HImode mult pattern first, it ought to match it,
> not match the non-subreg version that appears in the file later.
> (when insn have the subregs)
> The pattern itself seems to be correct, because once I disable the later (mulhi)
> pattern, everything works smoothly.
What about putting more stringent conditions in? Worked well for me on
the i860 (gotta get round to releasing the patchess...). eg:
+(define_insn ""
+ [(set (match_operand 0 "reg_or_load_operand" "=r,r,f,f,r,f,o,m,m")
+ (match_operand 1 "reg_or_load_operand" "r,f,r,f,m,m,r,f,m"))]
+ "((GET_MODE (operands[0]) == SImode && GET_MODE (operands[1]) ==
SImode)
+ || (GET_MODE (operands[0]) == PSImode && GET_MODE (operands[1]) ==
PSImode)
+ || (GET_MODE (operands[0]) == SFmode && GET_MODE (operands[1]) ==
SFmode))"
+ "@
+ shl %?r0,%1,%0
+ fxfr %1,%0
+ ixfr %1,%0
+ fmov.ss %1,%0
+ ld.l %1,%0
+ fld.l %1,%0
+ st.l %1,%0
+ fst.l %1,%0
+ #")
> ALso when I reverse order of patterns (HImode multiply goes first and
> disable the subreged patterns by condition "0", HImode multiply pattern
> never match.) So it looks like recog always try only the later of the patterns!
> Why?
I just had another look at your posted insn, and I think I know what's
wrong (ie why it won't match nicely): the clobber.
(define_insn "umulqihi3"
[(set (match_operand:HI 0 "register_operand" "=a")
(mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand"
"%0"))
(zero_extend:HI (match_operand:QI 2
"nonimmediate_operand" "qm"))))
(clobber (reg:CC 17))]
AIUI, a (set (x) (mult (y) (z))) will never match this unless it also
has a clobber in it. Should this not be defined as a define_expand and
then match against an unnamed insn? ie
(define_expand "umulqihi3"
[(set (match_operand:HI 0 "register_operand" "=a")
(mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand"
"%0"))
(zero_extend:HI (match_operand:QI 2
"nonimmediate_operand" "qm"))))
(clobber (reg:CC 17))]
define_insn ""
(set (match_operand:HI 0 "register_operand" "=a")
(mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand"
"%0"))
(zero_extend:HI (match_operand:QI 2
"nonimmediate_operand" "qm"))))]
I *think* this will work better, though I could be missing something.
HTH (or at least provides some ideas)
Bill
--
Leave others their otherness