https://bugs.llvm.org/show_bug.cgi?id=48524
Bug ID: 48524
Summary: Failure to optimize simple bitwise pattern
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
int f1(int n)
{
return n - (((n > 63) ? n : 63) & -64);
}
This can be optimized to `return (n <= 63) ? n : (n & 63);` (and presumably the
same optimization should be doable with other powers of 2).
PS: I found this optimization while looking at how this :
int f1(int n)
{
while (n >= 64)
n -= 64;
return n;
}
is optimized. LLVM outputs the first example I gave here, while GCC outputs the
optimization I gave here.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs