]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/120031 - CTZ pattern matching fails a case
authorRichard Biener <rguenther@suse.de>
Tue, 6 May 2025 06:36:01 +0000 (08:36 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 6 May 2025 09:17:44 +0000 (11:17 +0200)
commit5e363ffefaceb9ff8fdeeead247c8337538e01db
treee2b82902fe559610114d1d895b26e62734a1ca68
parent16e301adf7b653c72d5c3cae1c7287877f3f20ff
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.
gcc/match.pd
gcc/testsuite/gcc.target/i386/pr120031.c [new file with mode: 0644]