[llvm-bugs] [Bug 32433] New: [X86] Failure to use HADDPS for partial register result
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 27 07:04:21 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32433
Bug ID: 32433
Summary: [X86] Failure to use HADDPS for partial register
result
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
While the 256-bit horizontal pair sums work fine (both on btver2 and btver1),
the 128-bit version completely fails:
#include <x86intrin.h>
void sum_pairs_128(__m128 f, float *p) {
p[0] = f[0] + f[1];
p[1] = f[2] + f[3];
}
void sum_pairs_256(__m256 f, float *p) {
p[0] = f[0] + f[1];
p[1] = f[2] + f[3];
p[2] = f[4] + f[5];
p[3] = f[6] + f[7];
}
clang -O3 -march=btver2
sum_pairs_128(float __vector(4), float*):
vmovshdup %xmm0, %xmm1 # xmm1 = xmm0[1,1,3,3]
vaddss %xmm1, %xmm0, %xmm1
vmovss %xmm1, (%rdi)
vpermilpd $1, %xmm0, %xmm1 # xmm1 = xmm0[1,0]
vpermilps $231, %xmm0, %xmm0 # xmm0 = xmm0[3,1,2,3]
vaddss %xmm0, %xmm1, %xmm0
vmovss %xmm0, 4(%rdi)
retq
sum_pairs_256(float __vector(8), float*):
vextractf128 $1, %ymm0, %xmm1
vhaddps %xmm1, %xmm0, %xmm0
vmovups %xmm0, (%rdi)
retq
--
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/20170327/d5652a71/attachment.html>
More information about the llvm-bugs
mailing list