Hi! On Tue, Oct 29, 2019 at 01:34:15PM -0600, Jeff Law wrote: > That needs to turn into a define_insn_and_split. The idea is the form > above is what's seen prior to register allocation and reloading. After > reloading we turn it into a form with an attached clobber. We achieve > this by rewriting the pattern into a define_insn_and_split like this: > > > (define_insn_and_split "*addsi_h8300" > > [(set (match_operand:SI 0 "register_operand" "=r,r") > > (plus:SI (match_operand:SI 1 "register_operand" "%0,0") > > (match_operand:SI 2 "h8300_src_operand" "n,r")))] > > "TARGET_H8300" > > "#" > > "reload_completed" > > [(parallel [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2))) > > (clobber (reg:CC CC_REG))])]) > > We added the "#" which indicates the pattern has to be split and will > never generate assembly code in and of itself.
It is important to note that this indication is mostly a comment, and nothing more. The split condition ("reload_completed", here) is the only thing that determines if something is split or not. The exception is that final.c *does* look if the template is "#", and splits while outputting to asm. Normally though everything is split earlier already (there is a split pass almost immediately before final, one of the two that is run at -O0 as well). It's great to always write "#" here, it is nice documentation ("this insn is always split"), but you still need to get your split condition correct. Segher