This is an incremental improvement to the type narrowing in match.pd. It's largely based on the pattern I added to fix 47477. Basically if we have (bit_and (arith_op (convert A) (convert B)) mask) Where the conversions are widening and the mask turns off all bits outside the original types of A & B, then we can turn that into (bit_and (arith_op A B) mask) We may need to convert A & B to an unsigned type with the same width/precision as their original type, but that's still better than a widening conversion. Bootstrapped and regression tested on x86_64-linux-gnu. OK for the trunk?