https://bugs.llvm.org/show_bug.cgi?id=51567
Bug ID: 51567
Summary: Missing transformation rotr(X,C1) == C2 --> X == C3
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org
// rotr(X, C1) == C2 --> X == C3 where C3 = rotl(C2, C1)
// rotl(X,C1) == C2 --> X == C3 where C3 = rotr(C2,C1)
bool foo(unsigned int x)
{
unsigned int rx = rotr(x, 7);
return rx == 5;
}
bool bar(unsigned int x)
{
return x == rotl(5, 7);
}
Trunk -O2:
foo(unsigned int): # @foo(unsigned int)
rol edi, 25
cmp edi, 5
sete al
ret
bar(unsigned int): # @bar(unsigned int)
cmp edi, 640
sete al
ret
Current codegen:
https://godbolt.org/z/xb1vPa5Pq
Alive:
https://alive2.llvm.org/ce/z/GdY8Jm
--
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