[llvm-bugs] [Bug 52056] New: Regressed popcnt of unsigned short
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 3 15:27:18 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52056
Bug ID: 52056
Summary: Regressed popcnt of unsigned short
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, pengfei.wang at intel.com,
spatel+llvm at rotateright.com
int pc(unsigned short a) { return __builtin_popcount(a); }
LLVM trunk
pc(unsigned short): # @pc(unsigned short)
popcntw %di, %ax
movzwl %ax, %eax
retq
LLVM 12:
pc(unsigned short): # @pc(unsigned short)
popcntl %edi, %eax
retq
pc(unsigned short): # @pc(unsigned short)
popcntl %edi, %eax
retq
Maybe the solution is to add i16 -> i32 handling here in X86ISelLowering ?
if (Subtarget.hasPOPCNT()) {
setOperationPromotedToType(ISD::CTPOP, MVT::i8, MVT::i32);
} else { ....
https://gcc.godbolt.org/z/P7Pc63j1K
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211003/c2d240f4/attachment.html>
More information about the llvm-bugs
mailing list