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: unassignedb...@nondot.org
Reporter: gabrav...@gmail.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs