[llvm-bugs] [Bug 52057] New: Failure to optimize small vectors from using s
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 3 20:09:21 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52057
Bug ID: 52057
Summary: Failure to optimize small vectors from using s
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
typedef char V __attribute__((vector_size(2)));
V foo(V v)
{
v[(V){}[0]] <<= 1;
return v;
}
Code such as this seems to be very badly optimized for all targets that have
SIMD.
With -O3, Clang outputs this:
.LCPI0_0:
.byte 0 # 0x0
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
.byte 255 # 0xff
foo(char __vector(2)): # @foo(char __vector(2))
movd xmm0, edi
movdqa xmmword ptr [rsp - 24], xmm0
mov al, byte ptr [rsp - 24]
add al, al
movzx eax, al
movd xmm1, eax
pxor xmm2, xmm2
punpcklbw xmm1, xmm2 # xmm1 =
xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
pand xmm0, xmmword ptr [rip + .LCPI0_0]
por xmm0, xmm1
movd eax, xmm0
ret
GCC outputs this:
foo(char __vector(2)):
movsx edx, dil
mov eax, edi
add edx, edx
mov al, dl
ret
--
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/20211004/4f858a4d/attachment.html>
More information about the llvm-bugs
mailing list