[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-25 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #9 from Vladimir Makarov  ---
Author: vmakarov
Date: Mon Mar 25 21:14:40 2019
New Revision: 269924

URL: https://gcc.gnu.org/viewcvs?rev=269924=gcc=rev
Log:
2019-03-25  Vladimir Makarov  

PR rtl-optimization/89676
* lra-constraints.c (curr_insn_transform): Do match reload for
early clobbers when the match was successful only for different
registers.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-22 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #8 from Vladimir Makarov  ---
Author: vmakarov
Date: Fri Mar 22 16:59:21 2019
New Revision: 269878

URL: https://gcc.gnu.org/viewcvs?rev=269878=gcc=rev
Log:
2019-03-22  Vladimir Makarov  

PR rtl-optimization/89676
* lra-constraints.c (curr_insn_transform): Do match reload for
early clobbers even if the match was successful.

2019-03-22  Vladimir Makarov  

PR rtl-optimization/89676
* gcc.target/i386/pr89676.c: New.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr89676.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-20 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #7 from Vladimir Makarov  ---
(In reply to Jakub Jelinek from comment #6)
> 
> That said, if you can handle it in the RA, it could handle even those
> variable shift cases better (just make sure it doesn't overlap ecx, but
> otherwise allow the same reg as the first input).

I believe it should be fixed in RA.  It is a common case: earlyclobber output
with a matched input.  Currently they are conflicting and this results in worse
code generation.

Building conflict is now pretty complicated in LRA.  My idea is to reload and
use one reload register for the output and input even if their allocations
satisfy such constraints.  Actually, it is also good with LRA design to reflect
RA decisions in RTL as much as possible.

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #6 from Jakub Jelinek  ---
I wonder if in this case the instruction couldn't replace the current = 0n Ic
constraints e.g. with =r, 0n,0n I,c because if the shift count is constant,
then I don't see the point of early-clobber, if the two inputs are n and I,
then
there are no input registers (arguably that should have been folded earlier),
if
one input is 0 and the other one is I, then the earlyclobber doesn't make much
sense either, the first input is equal to the output and there is no other
input.
It is just the variable shift count where the count is in %cl register and
there we must make sure that the destination register will not overlap %cl even
when doing stuff like: unsigned long long x; ... x = x << (char) x;

That said, if you can handle it in the RA, it could handle even those variable
shift cases better (just make sure it doesn't overlap ecx, but otherwise allow
the same reg as the first input).

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-20 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #5 from Vladimir Makarov  ---
I am working on it.  It is a non-trivial problem.  We should somehow exclude
creation of conflicts in lra-lives.c for an early clobber matched with an
input.

I hope to fix it this week.

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #4 from Jakub Jelinek  ---
The above commit fixed PR86979 instead.

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-18 Thread abel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

--- Comment #3 from Andrey Belevantsev  ---
Author: abel
Date: Mon Mar 18 07:51:06 2019
New Revision: 269751

URL: https://gcc.gnu.org/viewcvs?rev=269751=gcc=rev
Log:
PR middle-end/89676
* sel-sched.c (compute_av_set_at_bb_end): When we have an ineligible
successor, use NULL as its av set.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/sel-sched.c

[Bug rtl-optimization/89676] [7/8/9 Regression] Redundant moves for long long shift on 32bit x86

2019-03-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |7.5
Summary|Redundant moves for long|[7/8/9 Regression]
   |long shift on 32bit x86 |Redundant moves for long
   ||long shift on 32bit x86

--- Comment #2 from Jakub Jelinek  ---
Started with r244942 (at least with -O2 -m32 -fomit-frame-pointer), before that
we emitted
foo:
movl4(%esp), %eax
movl8(%esp), %edx
shldl   $3, %eax, %edx
sall$3, %eax
ret