tree-optimization: [PR103245] Improve detection of abs pattern using multiplication
authorAndrew Pinski <apinski@marvell.com>
Mon, 15 Nov 2021 22:55:09 +0000 (22:55 +0000)
committerAndrew Pinski <apinski@marvell.com>
Tue, 16 Nov 2021 03:31:57 +0000 (03:31 +0000)
commit3200de91bc70bfd6d4b7b40e769bc82756b9b555
treef7c0910ed3a84d8c23b1d58c02cc54c421ce8b65
parent074ee8d9a91d7573c1e8774a22e4e08f923adb18
tree-optimization: [PR103245] Improve detection of abs pattern using multiplication

So while working on PR 103228 (and a few others), I noticed the testcase for PR 94785
was failing. The problem is that the nop_convert moved from being inside the IOR to be
outside of it. I also noticed the patch for PR 103228 was not needed to reproduce the
issue either.
This patch combines the two patterns together for the abs match when using multiplication
and adds a few places where nop_convert are optional.

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

PR tree-optimization/103245

gcc/ChangeLog:

* match.pd: Combine the abs pattern matching using multiplication.
Adding optional nop_convert too.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr103245-1.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr103245-1.c [new file with mode: 0644]