MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
commitc7609acb8a8210188d21b2cd72ecc6d3b2de2ab8
authorAndrew Pinski <pinskia@gmail.com>
Sun, 15 Oct 2023 17:36:56 +0000 (15 10:36 -0700)
committerAndrew Pinski <pinskia@gmail.com>
Mon, 16 Oct 2023 17:11:13 +0000 (16 10:11 -0700)
treee6518a09c07f7b6f4507f0235c84beee3b3034f9
parent29a4453c7b8a86d242dab89b9e4d222749fd911e
MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.

This improves the `A CMP 0 ? A : -A` set of match patterns to use
bitwise_equal_p which allows an nop cast between signed and unsigned.
This allows catching a few extra cases which were not being caught before.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

PR tree-optimization/101541
* match.pd (A CMP 0 ? A : -A): Improve
using bitwise_equal_p.

gcc/testsuite/ChangeLog:

PR tree-optimization/101541
* gcc.dg/tree-ssa/phi-opt-36.c: New test.
* gcc.dg/tree-ssa/phi-opt-37.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-36.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-37.c [new file with mode: 0644]