[llvm-bugs] [Bug 48737] New: Run loop-idiom with -Oz
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 13 05:54:03 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48737
Bug ID: 48737
Summary: Run loop-idiom with -Oz
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
void copy(float *__restrict__ d, float *__restrict__ s, __SIZE_TYPE__ sz) {
__SIZE_TYPE__ i;
for (i = 0; i < sz; i++) {
*d++ = *s++;
}
}
-Os
copy(float*, float*, unsigned long): # @copy(float*,
float*, unsigned long)
test rdx, rdx
je .LBB0_2
push rax
shl rdx, 2
call memcpy at PLT
add rsp, 8
.LBB0_2:
ret
-Oz
copy(float*, float*, unsigned long): # @copy(float*,
float*, unsigned long)
xor eax, eax
.LBB0_1: # =>This Inner Loop Header: Depth=1
cmp rdx, rax
je .LBB0_3
movss xmm0, dword ptr [rsi + 4*rax] # xmm0 = mem[0],zero,zero,zero
movss dword ptr [rdi + 4*rax], xmm0
inc rax
jmp .LBB0_1
.LBB0_3:
ret
https://godbolt.org/z/61EnzG
--
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/20210113/0188777c/attachment.html>
More information about the llvm-bugs
mailing list