[llvm-bugs] [Bug 42947] New: Reduction loop - missing horizontal adds
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 9 09:25:36 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42947
Bug ID: 42947
Summary: Reduction loop - missing horizontal adds
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
float Red(float* V)
{
float sum = 0.f;
for (int I = 0; I < 4; ++I)
{
sum += V[I];
}
return sum;
}
Clang -Ofast -march=skylake -mavx2
Red(float*): # @Red(float*)
vmovupd xmm0, xmmword ptr [rdi]
vpermilpd xmm1, xmm0, 1 # xmm1 = xmm0[1,0]
vaddps xmm0, xmm0, xmm1
vmovshdup xmm1, xmm0 # xmm1 = xmm0[1,1,3,3]
vaddss xmm0, xmm0, xmm1
ret
Newest MSVC:
V$ = 8
float Red(float *) PROC ; Red, COMDAT
vmovups xmm0, XMMWORD PTR [rcx]
vhaddps xmm1, xmm0, xmm0
vhaddps xmm0, xmm1, xmm1
ret 0
float Red(float *) ENDP
Current codegen: https://godbolt.org/z/FSy0Ca
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190809/c0f33e0e/attachment-0001.html>
More information about the llvm-bugs
mailing list