AVX-512: Fixed the "test" operation for i1 type
authorElena Demikhovsky <elena.demikhovsky@intel.com>
Thu, 12 Feb 2015 08:40:34 +0000 (08:40 +0000)
committerElena Demikhovsky <elena.demikhovsky@intel.com>
Thu, 12 Feb 2015 08:40:34 +0000 (08:40 +0000)
commitf41b8e3e49de626e81c5a3b497f389b3d5bd2788
tree3b781b163695a833bde317cff062f71354a515f0
parentfd98d3be5557c9a5952f42669a4ef561fc79c064
AVX-512: Fixed the "test" operation for i1 type

Using KORTESTW for comparison i1 value with zero was wrong since the instruction tests 16 bits.
KORTESTW may be used with KSHIFTL+KSHIFTR that clean the 15 upper bits.
I removed (X86cmp i1, 0) pattern and zero-extend i1 to i8 and then use TESTB.

There are some cases where i1 is in the mask register and the upper bits are already zeroed.
Then KORTESTW is the better solution, but it is subject for optimization.
Meanwhile, I'm fixing the correctness issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228916 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrAVX512.td
test/CodeGen/X86/avx512-i1test.ll
test/CodeGen/X86/avx512-insert-extract.ll