https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81396
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > Either we can do something in the bswap pass with it as done in this > untested patch, or we could consider match.pd optimization for: > _3 = BIT_FIELD_REF <_7, 8, 16>; > _32 = (typeof(_7)) _3; > _4 = _32 << 16; > into: > _4 = _7 & (((1ULL << 8) - 1) << 16); I am implementing the above because when I was adding detecting bit_insert more, bswap goes not understand bit_insert, plus we can optimize this earlier.