[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2017-04-05 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

--- Comment #13 from Vladimir Makarov  ---
Author: vmakarov
Date: Wed Apr  5 16:14:28 2017
New Revision: 246711

URL: https://gcc.gnu.org/viewcvs?rev=246711=gcc=rev
Log:
2017-04-05  Vladimir Makarov  

PR rtl-optimization/70703
* ira-color.c (update_conflict_hard_regno_costs): Use
HOST_WIDE_INT instead of long.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/ira-color.c

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2017-04-05 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

--- Comment #12 from Vladimir Makarov  ---
Author: vmakarov
Date: Wed Apr  5 15:07:51 2017
New Revision: 246707

URL: https://gcc.gnu.org/viewcvs?rev=246707=gcc=rev
Log:
2017-04-05  Vladimir Makarov  

PR rtl-optimization/70703
* ira-color.c (update_costs_from_allocno): Use the smallest mode.
(update_conflict_hard_regno_costs): Use long instead of unsigned
arithmetic for cost calculation.

2017-04-05  Vladimir Makarov  

PR rtl-optimization/70703
* gcc.target/i386/pr70703.c: New.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr70703.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ira-color.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2017-04-01 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Vladimir Makarov  changed:

   What|Removed |Added

 CC||vmakarov at gcc dot gnu.org

--- Comment #11 from Vladimir Makarov  ---
(In reply to Jakub Jelinek from comment #9)
> Vlad, any thoughts on this?
> 
I've been working on this and a wrong allocation is a culprit.  According to
IRA dump,  the allocation should be what we expect.  But it is not.  I guess
there are a few factors to this.  First of all IRA has cost 65535 for moving
AREG into/from GENERAL_REGS.  And second factor is an overflow on 32-bit
machine when such big cost is used in IRA.

I'll continue my work on it next week.  I hope the patch will be ready in the
middle of the next week.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2017-03-31 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

--- Comment #10 from Jakub Jelinek  ---
Created attachment 41094
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41094=edit
gcc7-pr70703-widen.patch

The widening_mult change.  We get tiny bit better code with it with the #c0
testcase:
-   movl$6700417, %ecx
-   movl%ecx, %eax
+   movl$6700417, %edx
+   movl%edx, %eax
mull4(%esp)
-   movl%edx, %ecx
-   movl%ecx, %eax
+   movl%edx, %eax
but still not ideal.  On the other side, we regress on -m64:
unsigned long
foo (unsigned long x)
{
  return ((__uint128_t) x * 0x663d811234567ULL) >> 64;
}

-   movabsq $1798629511873895, %rax
-   mulq%rdi
+   movq%rdi, %rax
+   movabsq $1798629511873895, %rdx
+   mulq%rdx

Another option is to deal with this at combine time, I see on the unpatched
compiler:
Failed to match this instruction:
(set (reg:SI 95)
(subreg:SI (mult:DI (zero_extend:DI (mem/c:SI (reg/f:SI 16 argp) [1 x+0 S4
A32]))
(const_int 6700417 [0x663d81])) 4))

Maybe we could add some define_insn_and_split that would deal with this and
make sure the constant is forced into a register (if the constant has depending
on  all upper bits zero or set) and transform it into the highpart insns?
Though, I'm worried about the regression above we got with the TImode highpart.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2017-03-31 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek  ---
Vlad, any thoughts on this?

I'll try to deal with this in the widening_mul pass too, that pass converts:
   _1 = (long long unsigned int) x_4(D);
-  _2 = _1 * 6700417;
+  _2 = x_4(D) w* 6700417;
   _3 = _2 >> 32;
   _5 = (unsigned int) _3;
but as the only user cares about the high part of the widened result, we could
convert it into:
   _1 = (long long unsigned int) x_4(D);
   _2 = _1 * 6700417;
   _3 = _2 >> 32;
-  _5 = (unsigned int) _3;
+  _5 = x_4(D) h* 6700417;
There is nothing that would attempt match.pd foldings after this.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-12-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|6.3 |6.4

--- Comment #8 from Jakub Jelinek  ---
GCC 6.3 is being released, adjusting target milestone.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-08-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

--- Comment #5 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

--- Comment #6 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

--- Comment #7 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-08-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

--- Comment #5 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

--- Comment #6 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-08-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|6.2 |6.3

--- Comment #4 from Richard Biener  ---
GCC 6.2 is being released, adjusting target milestone.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-07-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-06-14 Thread aldot at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Bernhard Reutner-Fischer  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-06-14 Thread aldot at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Bernhard Reutner-Fischer  changed:

   What|Removed |Added

   Last reconfirmed||2016-6-14
 CC||rdsandiford at googlemail dot 
com,
   ||vmakarov at redhat dot com
  Known to work||4.9.3
  Known to fail||5.1.0

--- Comment #3 from Bernhard Reutner-Fischer  ---
CCing Vlad and Richard S.
Started with r211072

https://gcc.gnu.org/ml/gcc-patches/2014-05/msg02482.html

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-04-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|6.0 |6.2

--- Comment #2 from Jakub Jelinek  ---
GCC 6.1 has been released.

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-04-20 Thread aldot at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Bernhard Reutner-Fischer  changed:

   What|Removed |Added

 CC||aldot at gcc dot gnu.org,
   ||hubicka at gcc dot gnu.org,
   ||uros at gcc dot gnu.org
 Blocks||16996

--- Comment #1 from Bernhard Reutner-Fischer  ---
Cc Uros


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16996
[Bug 16996] [meta-bug] code size improvements

[Bug rtl-optimization/70703] [6/7 regression] Regression in register usage on x86

2016-04-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70703

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.0