On 7/7/2026 5:19 AM, Eikansh Gupta wrote: > Fold bitwise operations involving zero and sign extensions from the same > low-precision value. The AND case folds to the zero extension, and the > OR case folds to the sign extension. > > PR tree-optimization/122848 > > gcc/ChangeLog: > > * match.pd (zero_extend & sign_extend -> zero_extend): New pattern. > (zero_extend | sign_extend -> sign_extend): Likewise. > > gcc/testsuite/ChangeLog: > > * gcc.dg/tree-ssa/pr122848.c: New test. LGTM. I had to convince myself the nop_conversion was needed, but it (like the convert nodes) is inherently needed for what you're trying to do.
Given match.pd isn't a strong area for me, I'd give others another 48hrs to chime in before committing. Which raises the issue of commit privs. I'm pretty sure that Andrea and I have been pushing patches for you. We should probably go ahead and get you commit privs so you can push approved patches. This page as a link to a form you fill out: https://gcc.gnu.org/gitwrite.html List me as approving your request. You can use any email for me you want :-) The admins will likely recognize [email protected] easiest, but again, any will work. Once approved you'll create an entry in the MAINTAINERS file and push this patch if there aren't any change requests/objections in the next 48hrs. Jeff
