https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116781
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- Created attachment 59602 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59602&action=edit pr116781-gjl.diff (In reply to Denis Chertykov from comment #1) > Probably we have a wring definition of "*tablejump_split" > > The patch: > > diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md > index aae8a696a63..a26309650f2 100644 > --- a/gcc/config/avr/avr.md > +++ b/gcc/config/avr/avr.md > @@ -7653,7 +7653,7 @@ > (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r,z")] > UNSPEC_INDEX_JMP)) > (use (label_ref (match_operand 1 "" ""))) > - (clobber (match_dup 0)) > + (clobber (match_scratch:HI 2 "=X,X,0")) > (clobber (const_int 0))] > "!AVR_HAVE_EIJMP_EICALL" > "#" > @@ -7759,7 +7759,7 @@ > (parallel [(set (pc) > (unspec:HI [(match_dup 7)] UNSPEC_INDEX_JMP)) > (use (label_ref (match_dup 3))) > - (clobber (match_dup 7)) > + (clobber (scratch:HI)) > (clobber (match_dup 8))])] > "" > { I am not sure whether that is expressing what is being clobbered (operand 0). The casesi expander must clobber the registers for operand 7 which it is cooking up, so the casesi expander looks correct to me. The tablejump insn for the 2-byte PC case would go something like: diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 550b01b36fb..7ba43030570 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -7713,7 +7713,7 @@ (define_insn_and_split "*tablejump_split" (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r,z")] UNSPEC_INDEX_JMP)) (use (label_ref (match_operand 1 "" ""))) - (clobber (match_dup 0)) + (clobber (match_operand:HI 2 "register_operand" "=0,0,0")) (clobber (const_int 0))] "!AVR_HAVE_EIJMP_EICALL" "#" @@ -7722,7 +7722,7 @@ (define_insn_and_split "*tablejump_split" (unspec:HI [(match_dup 0)] UNSPEC_INDEX_JMP)) (use (label_ref (match_dup 1))) - (clobber (match_dup 0)) + (clobber (match_dup 2)) (clobber (const_int 0)) (clobber (reg:CC REG_CC))])] "" @@ -7733,7 +7733,7 @@ (define_insn "*tablejump" (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r,z")] UNSPEC_INDEX_JMP)) (use (label_ref (match_operand 1 "" ""))) - (clobber (match_dup 0)) + (clobber (match_operand:HI 2 "register_operand" "=0,0,0")) (clobber (const_int 0)) (clobber (reg:CC REG_CC))] "!AVR_HAVE_EIJMP_EICALL && reload_completed" The reason is that it has to clobber regs it already has; the regs are NOT provided by reload. For the split pattern it should not matter whether (match_dup 0) or (match_dup 2) is used because they must be the same.