This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/77856] [7 Regression] wrong code at -O2 on x86_64-linux-gnu in 32-bit mode
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Nov 2016 15:56:35 +0000
- Subject: [Bug tree-optimization/77856] [7 Regression] wrong code at -O2 on x86_64-linux-gnu in 32-bit mode
- Auto-submitted: auto-generated
- References: <bug-77856-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77856
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vmakarov at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
To me this looks like a LRA bug. In *.ira we have:
(insn 210 18 20 3 (set (reg:SI 225 [ c.f1 ])
(const_int 1 [0x1])) "pr77856.c":24 82 {*movsi_internal}
(expr_list:REG_EQUAL (const_int 1 [0x1])
(nil)))
...
(insn 23 21 25 3 (parallel [
(set (reg:SI 119 [ _45 ])
(ashiftrt:SI (reg:SI 225 [ c.f1 ])
(subreg:QI (reg:SI 117 [ _42 ]) 0)))
(clobber (reg:CC 17 flags))
]) "pr77856.c":15 563 {*ashrsi3_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (ashiftrt:SI (const_int 1 [0x1])
(subreg:QI (reg:SI 117 [ _42 ]) 0))
(nil))))
(insn 25 23 3 3 (parallel [
(set (reg:SI 120 [ _46 ])
(ashift:SI (reg:SI 225 [ c.f1 ])
(subreg:QI (reg:SI 117 [ _42 ]) 0)))
(clobber (reg:CC 17 flags))
]) "pr77856.c":15 529 {*ashlsi3_1}
(expr_list:REG_DEAD (reg:SI 225 [ c.f1 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (ashift:SI (const_int 1 [0x1])
(subreg:QI (reg:SI 117 [ _42 ]) 0))
(nil)))))
(insn 3 25 4 3 (set (reg:SI 152 [ _81 ])
(const_int 1 [0x1])) "pr77856.c":24 82 {*movsi_internal}
(expr_list:REG_EQUAL (const_int 1 [0x1])
(nil)))
...
(insn 280 81 123 3 (set (reg:SI 240 [orig:152 _81 ] [152])
(reg:SI 152 [ _81 ])) "pr77856.c":32 82 {*movsi_internal}
(expr_list:REG_DEAD (reg:SI 152 [ _81 ])
(nil)))
and in *.reload we have:
(insn 210 337 336 3 (set (reg:SI 0 ax [orig:225 c.f1 ] [225])
(const_int 1 [0x1])) "pr77856.c":24 82 {*movsi_internal}
(expr_list:REG_EQUAL (const_int 1 [0x1])
(nil)))
...
(insn 23 287 286 3 (parallel [
(set (reg:SI 5 di [orig:119 _45 ] [119])
(ashiftrt:SI (reg:SI 5 di [orig:119 _45 ] [119])
(reg:QI 2 cx [243])))
(clobber (reg:CC 17 flags))
]) "pr77856.c":15 563 {*ashrsi3_1}
(expr_list:REG_EQUAL (ashiftrt:SI (const_int 1 [0x1])
(subreg:QI (reg:SI 117 [ _42 ]) 0))
(nil)))
(insn 286 23 290 3 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 20 [0x14])) [5 %sfp+-1004 S4 A32])
(reg:SI 5 di [orig:119 _45 ] [119])) "pr77856.c":15 82
{*movsi_internal}
(nil))
(insn 290 286 25 3 (set (reg:QI 2 cx [245])
(reg:QI 3 bx [orig:117 _42 ] [117])) "pr77856.c":15 85
{*movqi_internal}
(nil))
(insn 25 290 289 3 (parallel [
(set (reg:SI 0 ax [orig:225 c.f1 ] [225])
(ashift:SI (reg:SI 0 ax [orig:225 c.f1 ] [225])
(reg:QI 2 cx [245])))
(clobber (reg:CC 17 flags))
]) "pr77856.c":15 529 {*ashlsi3_1}
(expr_list:REG_EQUAL (ashift:SI (const_int 1 [0x1])
(subreg:QI (reg:SI 117 [ _42 ]) 0))
(nil)))
(insn 289 25 3 3 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 24 [0x18])) [5 %sfp+-1000 S4 A32])
(reg:SI 0 ax [orig:225 c.f1 ] [225])) "pr77856.c":15 82
{*movsi_internal}
(nil))
(note 3 289 333 3 NOTE_INSN_DELETED)
...
(insn 280 81 123 3 (set (reg:SI 3 bx [orig:152 _81 ] [152])
(reg:SI 0 ax [orig:152 _81 ] [152])) "pr77856.c":32 82
{*movsi_internal}
(nil))
So, %ebx doesn't hold 1 as it is supposed to, but 1 << %ecx (64).
Vlad, could you please have a look?