MATCH: Allow unsigned types for `X & -Y -> X * Y` pattern
commit7ceed7e3e29c3375e3b8c4347d1985a72bbe7f11
authorAndrew Pinski <apinski@marvell.com>
Wed, 7 Jun 2023 14:58:50 +0000 (7 07:58 -0700)
committerAndrew Pinski <apinski@marvell.com>
Fri, 9 Jun 2023 14:09:15 +0000 (9 07:09 -0700)
treee83fd55d965b5ba5094dbb040b22bc852fb4b724
parent72e652f3425079259faa4edefe1dc571f72f91e0
MATCH: Allow unsigned types for `X & -Y -> X * Y` pattern

This allows unsigned types if the inner type where the negation is
located has greater than or equal to precision than the outer type.

branchless-cond.c needs to be updated since now we change it to
use a multiply rather than still having (-a)&c in there.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* match.pd (`X & -Y -> X * Y`): Allow for truncation
and the same type for unsigned types.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/branchless-cond.c: Update testcase.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/branchless-cond.c