https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120031
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:5e363ffefaceb9ff8fdeeead247c8337538e01db commit r16-400-g5e363ffefaceb9ff8fdeeead247c8337538e01db Author: Richard Biener <rguent...@suse.de> Date: Tue May 6 08:36:01 2025 +0200 tree-optimization/120031 - CTZ pattern matching fails a case This PR is about the pattern matching in tree-ssa-forwprop.cc not working for the fallback implementation in ZSTD which uses a cast aroud the negation of the value to be tested. There's a pattern eliding casts in (T')-(T)x already but that only covered an inner widening conversion. The following extends this to other conversions given the negation will then be carried out in an unsigned type. PR tree-optimization/120031 * match.pd ((nop_outer_cast)-(inner_cast)var -> -(outer_cast)(var)): Allow inner conversions that are not widenings when the outer type is unsigned. * gcc.target/i386/pr120031.c: New testcase.