public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60104] New: load not folded into indirect branch on x86-64
@ 2014-02-07 0:17 dan433584 at gmail dot com
2014-05-30 18:00 ` [Bug target/60104] " ktietz at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dan433584 at gmail dot com @ 2014-02-07 0:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
Bug ID: 60104
Summary: load not folded into indirect branch on x86-64
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dan433584 at gmail dot com
Created attachment 32075
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32075&action=edit
a C testcase
The attached testcase is a greatly reduced interpreter loop, containing a
simple load and indirect branch:
goto *addresses[*pc++]
gcc 4.8.2 (as well as older versions) with -O2 produces the following x86-64
output:
movq addresses.1721(,%rax,8), %rax
jmp *%rax
Since the loaded value is not used after the branch, there's no need to hold it
in a register, so the load could be folded into the branch. This would improve
code size and instruction count.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
@ 2014-05-30 18:00 ` ktietz at gcc dot gnu.org
2014-09-14 8:30 ` fxcoudert at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-05-30 18:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
--- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Author: ktietz
Date: Fri May 30 18:00:11 2014
New Revision: 211089
URL: http://gcc.gnu.org/viewcvs?rev=211089&root=gcc&view=rev
Log:
PR target/60104
* config/i386/i386.c (x86_output_mi_thunk): Add memory case
for sibling-tail-calls.
* config/i386/i386.md (sibcall_insn_operand): Add memory-constrain
to its use.
* config/i386/predicates.md (sibcall_memory_operand): New predicate.
(sibcall_insn_operand): Add check for sibcall_memory_operand.
PR target/60104
* gcc.target/i386/sibcall-1.c: New test.
* gcc.target/i386/sibcall-2.c: New test.
* gcc.target/i386/sibcall-3.c: New test.
* gcc.target/i386/sibcall-4.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/sibcall-1.c
trunk/gcc/testsuite/gcc.target/i386/sibcall-2.c
trunk/gcc/testsuite/gcc.target/i386/sibcall-3.c
trunk/gcc/testsuite/gcc.target/i386/sibcall-4.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
trunk/gcc/config/i386/predicates.md
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
2014-05-30 18:00 ` [Bug target/60104] " ktietz at gcc dot gnu.org
@ 2014-09-14 8:30 ` fxcoudert at gcc dot gnu.org
2014-11-15 16:49 ` fxcoudert at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-09-14 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu.org
--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
This patch caused PR61387.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
2014-05-30 18:00 ` [Bug target/60104] " ktietz at gcc dot gnu.org
2014-09-14 8:30 ` fxcoudert at gcc dot gnu.org
@ 2014-11-15 16:49 ` fxcoudert at gcc dot gnu.org
2014-11-15 18:17 ` hjl.tools at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Testcase gcc.target/i386/sibcall-1.c fails on x86_64-apple-darwin14 (compiled
with "-O2 -m32"). Assembler code generated is:
.section __TEXT,__text_cold,regular,pure_instructions
LCOLDB0:
.text
LHOTB0:
.align 4,0x90
.globl _boo
_boo:
LFB0:
call ___x86.get_pc_thunk.ax
L1$pb:
movl L_foo$non_lazy_ptr-L1$pb(%eax), %eax
movl (%eax), %eax
jmp *%eax
LFE0:
.section __TEXT,__text_cold,regular,pure_instructions
LCOLDE0:
.text
LHOTE0:
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
.weak_definition ___x86.get_pc_thunk.ax
.private_extern ___x86.get_pc_thunk.ax
___x86.get_pc_thunk.ax:
LFB1:
movl (%esp), %eax
ret
LFE1:
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
.set L$set$0,LECIE1-LSCIE1
.long L$set$0
LSCIE1:
.long 0
.byte 0x1
.ascii "zR\0"
.byte 0x1
.byte 0x7c
.byte 0x8
.byte 0x1
.byte 0x10
.byte 0xc
.byte 0x5
.byte 0x4
.byte 0x88
.byte 0x1
.align 2
LECIE1:
LSFDE1:
.set L$set$1,LEFDE1-LASFDE1
.long L$set$1
LASFDE1:
.long LASFDE1-EH_frame1
.long LFB0-.
.set L$set$2,LFE0-LFB0
.long L$set$2
.byte 0
.align 2
LEFDE1:
LSFDE3:
.set L$set$3,LEFDE3-LASFDE3
.long L$set$3
LASFDE3:
.long LASFDE3-EH_frame1
.long LFB1-.
.set L$set$4,LFE1-LFB1
.long L$set$4
.byte 0
.align 2
LEFDE3:
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_foo$non_lazy_ptr:
.indirect_symbol _foo
.long 0
.subsections_via_symbols
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
` (2 preceding siblings ...)
2014-11-15 16:49 ` fxcoudert at gcc dot gnu.org
@ 2014-11-15 18:17 ` hjl.tools at gmail dot com
2014-11-15 19:46 ` fxcoudert at gcc dot gnu.org
2021-08-19 5:20 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-15 18:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Francois-Xavier Coudert from comment #3)
> Testcase gcc.target/i386/sibcall-1.c fails on x86_64-apple-darwin14
> (compiled with "-O2 -m32"). Assembler code generated is:
It is expected since this testcase always fails with PIC in 32-bit.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
` (3 preceding siblings ...)
2014-11-15 18:17 ` hjl.tools at gmail dot com
@ 2014-11-15 19:46 ` fxcoudert at gcc dot gnu.org
2021-08-19 5:20 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 19:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Author: fxcoudert
Date: Sat Nov 15 19:46:14 2014
New Revision: 217611
URL: https://gcc.gnu.org/viewcvs?rev=217611&root=gcc&view=rev
Log:
PR target/60104
* gcc.target/i386/sibcall-1.c: Don't run on pic targets.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/i386/sibcall-1.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/60104] load not folded into indirect branch on x86-64
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
` (4 preceding siblings ...)
2014-11-15 19:46 ` fxcoudert at gcc dot gnu.org
@ 2021-08-19 5:20 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19 5:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 53772 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-19 5:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-07 0:17 [Bug target/60104] New: load not folded into indirect branch on x86-64 dan433584 at gmail dot com
2014-05-30 18:00 ` [Bug target/60104] " ktietz at gcc dot gnu.org
2014-09-14 8:30 ` fxcoudert at gcc dot gnu.org
2014-11-15 16:49 ` fxcoudert at gcc dot gnu.org
2014-11-15 18:17 ` hjl.tools at gmail dot com
2014-11-15 19:46 ` fxcoudert at gcc dot gnu.org
2021-08-19 5:20 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).