https://bugs.llvm.org/show_bug.cgi?id=37938
Bug ID: 37938
Summary: Missed opportunity for BTR instruction
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org
Hello,
Code:
uint64_t btr_maybe(uint64_t x, unsigned bit) {
return x & ~(1ULL << bit);
}
Clang -03 gives:
btr_maybe: # @btr_maybe
mov rax, -2
mov ecx, esi
rol rax, cl
and rax, rdi
ret
But BTR instruction can be used (and GCC 8+ emits it):
btr_maybe(unsigned long, unsigned int):
mov rax, rdi
btr rax, rsi
ret
--
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