OSDN Git Service

Recommitting rL305465 after fixing bug in TableGen in rL306251 & rL306371
authorAyman Musa <ayman.musa@intel.com>
Tue, 27 Jun 2017 12:08:37 +0000 (12:08 +0000)
committerAyman Musa <ayman.musa@intel.com>
Tue, 27 Jun 2017 12:08:37 +0000 (12:08 +0000)
commitae1022198b4de754c4e839a2429fd77acdfbfbca
tree9f4a4b6696f6f9b6626862afeec215d4d2c704e2
parentd954633ce298f8c2a15419d42e2697e634af52df
Recommitting rL305465 after fixing bug in TableGen in rL306251 & rL306371

[X86][AVX512] Improve lowering of AVX512 compare intrinsics (remove redundant shift left+right instructions).

AVX512 compare instructions return v*i1 types.
In cases where the number of elements in the returned value are less than 8, clang adds zeroes to get a mask of v8i1 type.
Later on it's replaced with CONCAT_VECTORS, which then is lowered to many DAG nodes including insert/extract element and shift right/left nodes.
The fact that AVX512 compare instructions put the result in a k register and zeroes all its upper bits allows us to remove the extra nodes simply by copying the result to the required register class.

When lowering, identify these cases and transform them into an INSERT_SUBVECTOR node (marked legal), then catch this pattern in instructions selection phase and transform it into one avx512 cmp instruction.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306402 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrAVX512.td
test/CodeGen/X86/avx512vl-intrinsics-upgrade.ll
test/CodeGen/X86/avx512vl-vec-masked-cmp.ll [new file with mode: 0644]
test/CodeGen/X86/compress_expand.ll
test/CodeGen/X86/masked_memop.ll