https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109907
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- 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. The way I get this is to use BIT_FIELD_REF inside fold_single_bit_test . The first one I suspect load_extend_op for SImode returning SIGN_EXTEND for avr.