OSDN Git Service

[X86] Add a custom legalization for (i16 (bitcast v16i1)) and (i32 (bitcast v32i1...
authorCraig Topper <craig.topper@intel.com>
Mon, 26 Feb 2018 20:32:27 +0000 (20:32 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 26 Feb 2018 20:32:27 +0000 (20:32 +0000)
commitca6758faef62d18a1b7fb2bb1dd97fd984142d2f
tree16c6951477ef166ad1072db53fc75a9ef1760408
parentb4efe59b693f410859062deccb5f77e9c39110af
[X86] Add a custom legalization for (i16 (bitcast v16i1)) and (i32 (bitcast v32i1)) without AVX512 to prevent scalarization

Summary:
We have an early DAG combine to turn these patterns into MOVMSK, but that combine doesn't work if the vXi1 type has more elements than the widest legal vXi8 type. Type legalization will eventually split it down to v16i1 or v32i1 and then the bitcast gets legalized to a truncstore and a scalar load. The truncstore will get lowered to a series of extracts and bit math.

This patch adds a custom legalization to use a sign extend and MOVMSK instead. This prevents the eventual scalarization.

Reviewers: spatel, RKSimon, zvi

Reviewed By: RKSimon

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326119 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/bitcast-and-setcc-512.ll
test/CodeGen/X86/bitcast-setcc-128.ll
test/CodeGen/X86/bitcast-setcc-512.ll