[Bug middle-end/94785] Failure to detect abs pattern using multiplication
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94785 --- Comment #5 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:3200de91bc70bfd6d4b7b40e769bc82756b9b555 commit r12-5291-g3200de91bc70bfd6d4b7b40e769bc82756b9b555 Author: Andrew Pinski Date: Mon Nov 15 22:55:09 2021 + 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.
[Bug middle-end/94785] Failure to detect abs pattern using multiplication
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94785 Jakub Jelinek changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #4 from Jakub Jelinek --- Fixed for GCC 11.
[Bug middle-end/94785] Failure to detect abs pattern using multiplication
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94785 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8f12ce2ea3be12de4f83d3c419bdb1dc5036b202 commit r11-6377-g8f12ce2ea3be12de4f83d3c419bdb1dc5036b202 Author: Jakub Jelinek Date: Thu Dec 31 11:08:15 2020 +0100 match.pd: Add (-(X < 0) | 1) * X -> abs (X) etc. simplifications [PR94785] The following patch adds two simplifications to recognize idioms for ABS_EXPR resp. ABSU_EXPR. 2020-12-31 Jakub Jelinek PR tree-optimization/94785 * match.pd ((-(X < 0) | 1) * X -> abs (X)): New simplification. ((-(X < 0) | 1U) * X -> absu (X)): Likewise. * gcc.dg/tree-ssa/pr94785.c: New test.
[Bug middle-end/94785] Failure to detect abs pattern using multiplication
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94785 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Created attachment 49859 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49859=edit gcc11-pr94785.patch Untested fix.
[Bug middle-end/94785] Failure to detect abs pattern using multiplication
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94785 Richard Biener changed: What|Removed |Added Component|tree-optimization |middle-end Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords||easyhack Last reconfirmed||2020-04-27 --- Comment #1 from Richard Biener --- Note you likely want 1U | -(... as otherwise you implicitely assert that v != INT_MIN due to -1 * INT_MIN invoking undefined overflow. We still can do the transform to abs, of course.