* [Bug c/57046] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
@ 2013-04-23 11:31 ` mikpe at it dot uu.se
2013-04-23 12:04 ` [Bug c/57046] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2013-04-23 11:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2013-04-23 11:31:06 UTC ---
Created attachment 29918
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29918
Single-file test case.
I can reproduce the wrong-code on x86_64-linux with gcc 4.9-20130421 and
4.8-20130418, using -m32 -O2 -Wall. gcc 4.7 and 4.6 generate correct code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
2013-04-23 11:31 ` [Bug c/57046] " mikpe at it dot uu.se
@ 2013-04-23 12:04 ` rguenth at gcc dot gnu.org
2013-04-23 12:10 ` [Bug rtl-optimization/57046] " jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-23 12:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |i?86-*-*
Status|UNCONFIRMED |NEW
Keywords| |wrong-code
Last reconfirmed| |2013-04-23
Ever Confirmed|0 |1
Summary|wrong code generated by gcc |[4.8/4.9 Regression] wrong
|4.8.0 on i686 |code generated by gcc 4.8.0
| |on i686
Target Milestone|--- |4.8.1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-23 12:04:18 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
2013-04-23 11:31 ` [Bug c/57046] " mikpe at it dot uu.se
2013-04-23 12:04 ` [Bug c/57046] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2013-04-23 12:10 ` jakub at gcc dot gnu.org
2013-04-23 12:26 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-23 12:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |jakub at gcc dot gnu.org,
| |vmakarov at gcc dot gnu.org
Component|c |rtl-optimization
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-23 12:09:58 UTC ---
Started with http://gcc.gnu.org/r192719 aka LRA merge, the problematic function
is emac_operation.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
` (2 preceding siblings ...)
2013-04-23 12:10 ` [Bug rtl-optimization/57046] " jakub at gcc dot gnu.org
@ 2013-04-23 12:26 ` jakub at gcc dot gnu.org
2013-04-23 15:34 ` vmakarov at redhat dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-23 12:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-23 12:26:35 UTC ---
We have after the get_value call:
(insn 73 30 32 6 (set (reg:SI 76 [ D.1441 ])
(reg:SI 0 ax)) pr57046.c:42 85 {*movsi_internal}
(expr_list:REG_DEAD (reg:SI 0 ax)
(nil)))
(insn 32 73 33 6 (parallel [
(set (reg:SI 73 [ D.1443 ])
(ashift:SI (subreg:SI (reg:DI 60 [ D.1441 ]) 0)
(const_int 2 [0x2])))
(clobber (reg:CC 17 flags))
]) 502 {*ashlsi3_1}
(expr_list:REG_DEAD (reg:DI 60 [ D.1441 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
and IRA decides to put pseudo 76 into %ebx and pseudo 60 into %ecx. Either it
is an IRA bug, or IRA takes into account that we only really need the low
32-bits of pseudo 60 at that point. In any case, reload loads SImode %ecx from
the stack and uses it in the shift, while LRA loads full DImode %ecx (i.e. %ecx
and %ebx) from the stack, then uses just the low bits from that (i.e. %ecx) in
the shift. So the LRA generated code clobbers the value in %ebx, and get_value
call is even later on DCEd because of it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
` (3 preceding siblings ...)
2013-04-23 12:26 ` jakub at gcc dot gnu.org
@ 2013-04-23 15:34 ` vmakarov at redhat dot com
2013-04-26 18:03 ` [Bug rtl-optimization/57046] [4.8 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vmakarov at redhat dot com @ 2013-04-23 15:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Vladimir Makarov <vmakarov at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vmakarov at redhat dot com
--- Comment #5 from Vladimir Makarov <vmakarov at redhat dot com> 2013-04-23 15:34:40 UTC ---
(In reply to comment #4)
> We have after the get_value call:
> (insn 73 30 32 6 (set (reg:SI 76 [ D.1441 ])
> (reg:SI 0 ax)) pr57046.c:42 85 {*movsi_internal}
> (expr_list:REG_DEAD (reg:SI 0 ax)
> (nil)))
> (insn 32 73 33 6 (parallel [
> (set (reg:SI 73 [ D.1443 ])
> (ashift:SI (subreg:SI (reg:DI 60 [ D.1441 ]) 0)
> (const_int 2 [0x2])))
> (clobber (reg:CC 17 flags))
> ]) 502 {*ashlsi3_1}
> (expr_list:REG_DEAD (reg:DI 60 [ D.1441 ])
> (expr_list:REG_UNUSED (reg:CC 17 flags)
> (nil))))
>
> and IRA decides to put pseudo 76 into %ebx and pseudo 60 into %ecx. Either it
> is an IRA bug, or IRA takes into account that we only really need the low
> 32-bits of pseudo 60 at that point. In any case, reload loads SImode %ecx from
> the stack and uses it in the shift, while LRA loads full DImode %ecx (i.e. %ecx
> and %ebx) from the stack, then uses just the low bits from that (i.e. %ecx) in
> the shift. So the LRA generated code clobbers the value in %ebx, and get_value
> call is even later on DCEd because of it.
It seems like a discrepancy in IRA which allocates in terms of subregisters and
LRA splitting (including call save/restore as in this case) in terms of
pseudos. I guess fixing this might take about week.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
` (4 preceding siblings ...)
2013-04-23 15:34 ` vmakarov at redhat dot com
@ 2013-04-26 18:03 ` jakub at gcc dot gnu.org
2013-05-02 19:29 ` jakub at gcc dot gnu.org
2013-05-21 1:53 ` eraman at google dot com
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-26 18:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.7.2, 4.9.0
Summary|[4.8/4.9 Regression] wrong |[4.8 Regression] wrong code
|code generated by gcc 4.8.0 |generated by gcc 4.8.0 on
|on i686 |i686
Known to fail| |4.8.0
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-26 18:03:02 UTC ---
Author: vmakarov
Date: Wed Apr 24 20:27:33 2013
New Revision: 198263
URL: http://gcc.gnu.org/viewcvs?rev=198263&root=gcc&view=rev
Log:
2013-04-24 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimizations/57046
* lra-constraints (split_reg): Set up lra_risky_transformations_p
for multi-reg splits.
2013-04-24 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimizations/57046
* gcc.target/i386/pr57046.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr57046.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
` (5 preceding siblings ...)
2013-04-26 18:03 ` [Bug rtl-optimization/57046] [4.8 " jakub at gcc dot gnu.org
@ 2013-05-02 19:29 ` jakub at gcc dot gnu.org
2013-05-21 1:53 ` eraman at google dot com
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-02 19:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-02 19:29:52 UTC ---
Author: vmakarov
Date: Thu May 2 17:52:45 2013
New Revision: 198556
URL: http://gcc.gnu.org/viewcvs?rev=198556&root=gcc&view=rev
Log:
2013-05-02 Vladimir Makarov <vmakarov@redhat.com>
Backport from mainline
2013-04-24 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimizations/57046
* lra-constraints (split_reg): Set up lra_risky_transformations_p
for multi-reg splits.
2013-05-02 Vladimir Makarov <vmakarov@redhat.com>
Backport from mainline
2013-04-24 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimizations/57046
* gcc.target/i386/pr57046.c: New test.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gcc.target/i386/pr57046.c
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/lra-constraints.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/57046] [4.8 Regression] wrong code generated by gcc 4.8.0 on i686
2013-04-23 10:42 [Bug c/57046] New: wrong code generated by gcc 4.8.0 on i686 mattiase at acm dot org
` (6 preceding siblings ...)
2013-05-02 19:29 ` jakub at gcc dot gnu.org
@ 2013-05-21 1:53 ` eraman at google dot com
7 siblings, 0 replies; 9+ messages in thread
From: eraman at google dot com @ 2013-05-21 1:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Easwaran Raman <eraman at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eraman at google dot com
--- Comment #8 from Easwaran Raman <eraman at google dot com> ---
*** Bug 57088 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread