[Bug other/78366] New: target_clones does not generate resovler function
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 15 15:36:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78366
Bug ID: 78366
Summary: target_clones does not generate resovler function
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
The doc to target_clones says
# For instance, on an x86, you could compile a function with
# `target_clones("sse4.1,avx")'. GCC creates two function clones,
# one compiled with `-msse4.1' and another with `-mavx'. It also
# creates a resolver function (see the `ifunc' attribute above) that
# dynamically selects a clone suitable for current architecture.
Gcc creates the three functions all right, but it does not create the
resolver function; or at least I am unable to find it in the assembly
code.
double foo(double *, double *, int) __attribute__
((target_clones("avx,default")));
double foo(double *a, double *b, int n)
{
double s;
int i;
s = 0.0;
for (i=0; i<n; i++)
s += a[i] + b[i];
return s;
}
ig25@linux-fd1f:~/Krempel/Target> gcc -O -S target.c
ig25@linux-fd1f:~/Krempel/Target> cat target.s
.file "target.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
testl %edx, %edx
jle .L4
leal -1(%rdx), %edx
addq $1, %rdx
movl $0, %eax
pxor %xmm0, %xmm0
.L3:
movsd (%rdi,%rax,8), %xmm1
addsd (%rsi,%rax,8), %xmm1
addsd %xmm1, %xmm0
addq $1, %rax
cmpq %rdx, %rax
jne .L3
rep ret
.L4:
pxor %xmm0, %xmm0
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.type foo.avx.0, @function
foo.avx.0:
.LFB1:
.cfi_startproc
testl %edx, %edx
jle .L9
leal -1(%rdx), %edx
addq $1, %rdx
movl $0, %eax
vxorpd %xmm0, %xmm0, %xmm0
.L8:
vmovsd (%rdi,%rax,8), %xmm1
vaddsd (%rsi,%rax,8), %xmm1, %xmm1
vaddsd %xmm1, %xmm0, %xmm0
addq $1, %rax
cmpq %rdx, %rax
jne .L8
rep ret
.L9:
vxorpd %xmm0, %xmm0, %xmm0
ret
.cfi_endproc
.LFE1:
.size foo.avx.0, .-foo.avx.0
.ident "GCC: (GNU) 7.0.0 20161112 (experimental)"
.section .note.GNU-stack,"",@progbits
More information about the Gcc-bugs
mailing list