https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109992
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-05-26 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- After my lowering pass (little-endian) we have: _1 = BIT_FIELD_REF <_9, 29, 3>; _2 = (unsigned int) _1; _3 = _2 + add_7(D); _4 = (<unnamed-unsigned:29>) _3; _11 = BIT_INSERT_EXPR <_9, _4, 3 (29 bits)>; Which I suspect we could pattern match to: _t = add_7 << 3; _11 = _9 + _t; iff 3+29 == 32(int) Big-endian (with fields a and b swapped order in the source): _9 = MEM[(struct foo *)p_6(D)]; _1 = BIT_FIELD_REF <_9, 29, 0>; _2 = (unsigned int) _1; _3 = _2 + add_7(D); _4 = (<unnamed-unsigned:29>) _3; _11 = BIT_INSERT_EXPR <_9, _4, 0 (29 bits)>; Similar pattern matching, just using 0 for the offset rather than 3 ...