[llvm-bugs] [Bug 46138] New: Failure to avoid emitting a useless instruction when doing combined shits and rotates with a smaller result
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 29 16:17:24 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46138
Bug ID: 46138
Summary: Failure to avoid emitting a useless instruction when
doing combined shits and rotates with a smaller result
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
uint32_t f()
{
static uint64_t x = 0;
x++;
x = (x>>32) | (x<<32);
return x;
}
With -O3, GCC outputs this :
f():
mov rax, QWORD PTR msws()::x[rip]
inc rax
rorx rax, rax, 32
mov QWORD PTR msws()::x[rip], rax
ret
LLVM outputs this :
msws(): # @msws()
mov rax, qword ptr [rip + msws()::x]
inc rax
rorx rcx, rax, 32
shr rax, 32
mov qword ptr [rip + msws()::x], rcx
ret
The `shr` could be elimiated and replaced with part of the result of the
preceding rotate
--
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/20200529/bcdf3d69/attachment.html>
More information about the llvm-bugs
mailing list