https://bugs.llvm.org/show_bug.cgi?id=39174
Bug ID: 39174
Summary: Use "bt" for switch select from bitmask?
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: h...@chromium.org
CC: llvm-bugs@lists.llvm.org
For example:
bool f(int x) {
switch (x) {
case 0: return true;
case 1: return true;
case 2: return false;
case 3: return false;
case 4: return true;
}
}
SimplifyCFG will generate a "table lookup" from a bitmask, and on X86_64 we end
up with:
f(int): # @f(int)
# %bb.0:
mov al, 19
mov ecx, edi
shr al, cl
and al, 1
ret
I wonder if we could get tighter code with the BT instruction.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs