https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116781
--- Comment #4 from Denis Chertykov <denisc at gcc dot gnu.org> --- (In reply to Georg-Johann Lay from comment #2) > Created attachment 59602 [details] > 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")) I'm not sure that we need `match_operand:HI 2 "register_operand"' here. In this case gcc will generate pseudo for this operand from the first RTL pass. In case of `(clobber (match_scratch' the pseudo will be generated only by register allocator and after allocation it will be a HARDREG. The cost is unnecessary pseudo. > (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")) And here too