https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109907

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> For cset_32bit30_not with some patches which I will be posting, I get:
>         bst r25,6        ;  23  [c=4 l=3]  *extzv/4
>         clr r24
>         bld r24,0
>         ldi r25,lo8(1)   ;  24  [c=4 l=1]  movqi_insn/1
>         eor r24,r25      ;  25  [c=4 l=1]  *xorqi3
> /* epilogue start */
>         ret              ;  28  [c=0 l=1]  return
> 
> Which is better than what was there before.

Quite impressive improvement.  Maybe the last step can be achieved with a
combiner pattern that combines extzv with a bit flip.

One problem is usually that there is no canonical form (sometimes zero_extract,
sometimes shift+and, sometimes with subregs for extraction or paradoxical
subregs for wider types, different behaviour for MSB, etc.).

avr's extzv currently reads

(define_expand "extzv"
  [(set (match_operand:QI 0 "register_operand")
        (zero_extract:QI (match_operand:QI 1 "register_operand")
                         (match_operand:QI 2 "const1_operand")
                         (match_operand:QI 3 "const_0_to_7_operand")))])

Maybe QI for op1 is not optimal, but it's not possible to use mode iterator
because there's only one gen_extzv.  Dunno if VOIDmode would help or is sane.

> The first one I suspect load_extend_op for SImode returning SIGN_EXTEND for
> avr.

It's not implemented for avr, thus UNKNOWN as of defaults.h.

Reply via email to