https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79357
Bug ID: 79357
Summary: Doubling a single complex float is not vectorised
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: drraph at gmail dot com
Target Milestone: ---
Consider the following code:
#include <complex.h>
complex float f(complex float x) {
return 2*x;
}
gcc with -O3 -march=core-avx2 gives:
f:
vmovq QWORD PTR [rsp-8], xmm0
vmovss xmm1, DWORD PTR [rsp-8]
vmovss xmm0, DWORD PTR [rsp-4]
vaddss xmm1, xmm1, xmm1
vaddss xmm0, xmm0, xmm0
vmovss DWORD PTR [rsp-16], xmm1
vmovss DWORD PTR [rsp-12], xmm0
vmovq xmm0, QWORD PTR [rsp-16]
ret
Better and still suitable without -ffast-math would be:
f:
vmulps xmm0, xmm0, XMMWORD PTR .L_2il0floatpacket.1[rip] #3.12
ret