[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2018-09-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-09-12
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2018-09-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

--- Comment #1 from Jakub Jelinek  ---
With the to be posted patch, f1 and f3 remains the same, f2 and f4 improves:
-   movl%edi, %eax
-   sarl$31, %eax
-   shrl$28, %eax
-   addl%eax, %edi
+   xorl%eax, %eax
andl$15, %edi
-   cmpl%eax, %edi
setne   %al
-   movzbl  %al, %eax
for f2 and
-   movl%edi, %eax
-   sarl$31, %eax
-   shrl$28, %eax
-   addl%eax, %edi
andl$15, %edi
-   cmpl%eax, %edi
je  .L9
for f4 at -O2.

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2018-09-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

--- Comment #2 from Jakub Jelinek  ---
Created attachment 44681
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44681&action=edit
gcc9-pr87287.patch

Untested fix.

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2018-09-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Thu Sep 13 07:36:50 2018
New Revision: 264260

URL: https://gcc.gnu.org/viewcvs?rev=264260&root=gcc&view=rev
Log:
PR tree-optimization/87287
* fold-const.c (fold_binary_loc) : Move signed modulo
X % C == 0 to X % (unsigned) C == 0 optimization to ...
* match.pd (X % C == 0): ... here.  New optimization.

* gcc.dg/tree-ssa/pr87287.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr87287.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/match.pd
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2018-09-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jakub Jelinek  ---
Done for trunk.

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Target Milestone|--- |9.0

[Bug tree-optimization/87287] Move signed (x % pow2) == 0 optimization to gimple

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287

Andrew Pinski  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #5 from Andrew Pinski  ---
*** Bug 71149 has been marked as a duplicate of this bug. ***