[X86] Use xmm registers to implement 64-bit popcnt on 32-bit targets if possible...
authorCraig Topper <craig.topper@intel.com>
Fri, 22 Mar 2019 20:47:02 +0000 (20:47 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 22 Mar 2019 20:47:02 +0000 (20:47 +0000)
commitce1ed55a4a4a6ec49a7fa4dc411de24147aacab5
treee92cbb38f1adcd9b51e6e6bf2f5e43d3f1ce8a21
parent1ffd8e8114bc34295380b7fed815c7cf7644e84e
[X86] Use xmm registers to implement 64-bit popcnt on 32-bit targets if possible if popcnt instruction is not available

On 32-bit targets without popcnt, we currently expand 64-bit popcnt to sequences of arithmetic and logic ops for each 32-bit half and then add the 32 bit halves together. If we have xmm registers we can use use those to implement the operation instead. This results in less instructions then doing two separate 32-bit popcnt sequences.

This mitigates some of PR41151 for the i64 on i686 case when we have SSE2.

Differential Revision: https://reviews.llvm.org/D59662

llvm-svn: 356808
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/popcnt.ll