public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/95779] New: Unnecessary dispatch function for static target_clones function.
@ 2020-06-20 5:20 yyc1992 at gmail dot com
0 siblings, 0 replies; only message in thread
From: yyc1992 at gmail dot com @ 2020-06-20 5:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95779
Bug ID: 95779
Summary: Unnecessary dispatch function for static target_clones
function.
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: yyc1992 at gmail dot com
Target Milestone: ---
Using the code in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95778 the full
assembly generated (the version with both noinline) is (disabled unwind info),
```
.file "b.c"
.text
.p2align 4
.type f2.default.1, @function
f2.default.1:
movl (%rdi), %eax
ret
.size f2.default.1, .-f2.default.1
.p2align 4
.type g2.default.1, @function
g2.default.1:
jmp f2.default.1
.size g2.default.1, .-g2.default.1
.p2align 4
.type f2.avx2.0, @function
f2.avx2.0:
movl (%rdi), %eax
ret
.size f2.avx2.0, .-f2.avx2.0
.p2align 4
.type g2.avx2.0, @function
g2.avx2.0:
jmp f2.avx2.0
.size g2.avx2.0, .-g2.avx2.0
.section .text.g2.resolver,"axG",@progbits,g2.resolver,comdat
.p2align 4
.weak g2.resolver
.type g2.resolver, @function
g2.resolver:
subq $8, %rsp
call __cpu_indicator_init@PLT
movq __cpu_model@GOTPCREL(%rip), %rax
leaq g2.avx2.0(%rip), %rdx
testb $4, 13(%rax)
leaq g2.default.1(%rip), %rax
cmovne %rdx, %rax
addq $8, %rsp
ret
.size g2.resolver, .-g2.resolver
.globl g2
.type g2, @gnu_indirect_function
.set g2,g2.resolver
.text
.p2align 4
.type f2.resolver, @function
f2.resolver:
subq $8, %rsp
call __cpu_indicator_init@PLT
movq __cpu_model@GOTPCREL(%rip), %rax
leaq f2.avx2.0(%rip), %rdx
testb $4, 13(%rax)
leaq f2.default.1(%rip), %rax
cmovne %rdx, %rax
addq $8, %rsp
ret
.size f2.resolver, .-f2.resolver
.ident "GCC: (GNU) 10.1.0"
.section .note.GNU-stack,"",@progbits
```
AFAICT the `f2.resolver` is never used anywhere and can be omitted (all caller
of `f2` are statically dispatched).
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-20 5:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 5:20 [Bug other/95779] New: Unnecessary dispatch function for static target_clones function yyc1992 at gmail dot com
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).