[llvm-bugs] [Bug 47661] New: Reuse flags from neg to eliminate test instruction
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Sep 27 14:46:40 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47661
Bug ID: 47661
Summary: Reuse flags from neg to eliminate test instruction
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
foo(unsigned long long const*, unsigned long long*, unsigned long long):
# @foo(unsigned long long const*, unsigned long long*,
unsigned long long)
test rdx, rdx
je .LBB0_3
neg rdx
.LBB0_2: # =>This Inner Loop Header: Depth=1
mov rax, qword ptr [rdi + 8*rdx]
and qword ptr [rsi + 8*rdx], rax
inc rdx
jne .LBB0_2
.LBB0_3:
ret
Clang -Os:
foo(unsigned long long const*, unsigned long long*, unsigned long long):
# @foo(unsigned long long const*, unsigned long long*,
unsigned long long)
test rdx, rdx
je .LBB0_3
neg rdx
.LBB0_2: # =>This Inner Loop Header: Depth=1
mov rax, qword ptr [rdi + 8*rdx]
and qword ptr [rsi + 8*rdx], rax
inc rdx
jne .LBB0_2
.LBB0_3:
ret
GCC -O2:
foo(unsigned long long const*, unsigned long long*, unsigned long long):
neg rdx
je .L1
.L3:
mov rax, QWORD PTR [rdi+rdx*8]
and QWORD PTR [rsi+rdx*8], rax
add rdx, 1
jne .L3
.L1:
ret
https://godbolt.org/z/av85T1
--
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/20200927/8fe2626a/attachment.html>
More information about the llvm-bugs
mailing list