https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109907
--- Comment #22 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Georg-Johann Lay from comment #20) > What then happens is: > > expr.cc::do_store_flag() > expmed.cc::emit_store_flag_force() > expmed.cc::emit_store_flag() > expmed.cc::emit_store_flag_1() > > the latter then does: > > if (STORE_FLAG_VALUE == 1 || normalizep) > /* If we are supposed to produce a 0/1 value, we want to do > a logical shift from the sign bit to the low-order bit; for > a -1/0 value, we do an arithmetic shift. */ > op0 = expand_shift (RSHIFT_EXPR, int_mode, op0, > GET_MODE_BITSIZE (int_mode) - 1, > subtarget, normalizep != -1); > > "normalizep" is true because ops->type has a precision of 1, and > STORE_FLAG_VALUE is the default of 1. > > Nowhere is there any cost computation or consideration whether extzv could > do the trick. Thanks for tracking down where the shift is expanded to. Let me try to use extract_bit_field there instead (which should produce the better code).