Hi! On Thu, Dec 10, 2020 at 08:41:11PM -0600, acsaw...@linux.ibm.com wrote: > This patch adds a new function to genfusion.pl to generate patterns for > logical-logical fusion. They are enabled by default for power10 and can > be disabled by -mno-power10-fusion-2logical or -mno-power10-fusion.
> +;; logical-logical fusion pattern generated by gen_2logical > +;; kind: scalar outer: and op and rtl and inv 0 comp 0 > +;; inner: and op and rtl and inv 0 comp 0 These lines are a bit mysterious; can you make them more obvious somehow? (You do want to keep it short maybe, so it may be hard then). > +(define_insn "*fuse_and_and" > + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&r,0,1,r") > + (and:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") > (match_operand:GPR 1 "gpc_reg_operand" "%r,r,r,r")) (match_operand:GPR 2 > "gpc_reg_operand" "r,r,r,r"))) > + (clobber (match_scratch:GPR 4 "=X,X,X,r"))] You miss some newlines here: [(set (match_operand:GPR 3 "gpc_reg_operand" "=&r,0,1,r") (and:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") (match_operand:GPR 1 "gpc_reg_operand" "%r,r,r,r")) (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) (clobber (match_scratch:GPR 4 "=X,X,X,r"))] The alt 3 clobber needs an earlyclobber, because you clobber it before operand 2, which can be in the same hard reg. Likely? Not at all. Impossible? Also not clear! It may be true, but needs some explanation then. (Does % help here btw?) > + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2LOGICAL)" > + "@ > + and %3,%1,%0\;and %3,%3,%2 > + and %0,%1,%0\;and %0,%0,%2 > + and %1,%1,%0\;and %1,%1,%2 > + and %4,%1,%0\;and %3,%4,%2" Since you bind op 3 to op 0 resp. 1 in the alts 0 and 1, you can use exactly the same template as for alt 0 for them, which probably is easier to read, like: "@ and %3,%1,%0\;and %3,%3,%2 and %3,%1,%0\;and %3,%3,%2 and %3,%1,%0\;and %3,%3,%2 and %4,%1,%0\;and %3,%4,%2" Do you agree? Or is that nasty for other patterns maybe :-) Have you checked that all these pattern combinations canonicalise to the RTL you use here? Okay for trunk with those things considered / fixed. Thanks! Segher