middle-end/106414 - fix mistake in ~(x ^ y) -> x == y pattern
authorRichard Biener <rguenther@suse.de>
Mon, 25 Jul 2022 10:10:48 +0000 (12:10 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 25 Jul 2022 11:24:47 +0000 (13:24 +0200)
commit613e3b86955ea3b4977490625328708e82bea6fa
tree3c1f2304fa01fa140a1e128ce7c2709ec5e360ad
parenteb966d393dfdfd2c80994e4bfcc0dddf85828a73
middle-end/106414 - fix mistake in ~(x ^ y) -> x == y pattern

When compares are integer typed the inversion with ~ isn't properly
preserved by the equality comparison even when converting the
result properly.  The following fixes this by restricting the
input precisions accordingly.

PR middle-end/106414
* match.pd (~(x ^ y) -> x == y): Restrict to single bit
precision types.

* gcc.dg/torture/pr106414-1.c: New testcase.
* gcc.dg/torture/pr106414-2.c: Likewise.
gcc/match.pd
gcc/testsuite/gcc.dg/torture/pr106414-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr106414-2.c [new file with mode: 0644]