OSDN Git Service

Fix bug 30945- [AVX512] Failure to flip vector comparison to remove not mask instruction
authorMichael Zuckerman <Michael.zuckerman@intel.com>
Wed, 14 Dec 2016 14:57:10 +0000 (14:57 +0000)
committerMichael Zuckerman <Michael.zuckerman@intel.com>
Wed, 14 Dec 2016 14:57:10 +0000 (14:57 +0000)
commitc6e4e5fb03ac4697e19165b54576e89887a0c987
tree0b16058ef8538ead721058778299a367a510dac1
parent916007330ad823cda4bb5bb1c6459bf4bfdd6e2c
Fix bug 30945- [AVX512] Failure to flip vector comparison to remove not mask instruction

adding new optimization opportunity by adding new X86ISelLowering pattern. The test case was shown in https://llvm.org/bugs/show_bug.cgi?id=30945.

Test explanation:
Select gets three arguments mask, op and op2. In this case, the Mask is a result of ICMP. The ICMP instruction compares (with equal operand) the zero initializer vector and the result of the first ICMP.

In general, The result of "cmp eq, op1, zero initializers" is "not(op1)" where op1 is a mask. By rearranging of the two arguments inside the Select instruction, we can get the same result. Without the necessary of the middle phase ("cmp eq, op1, zero initializers").

Missed optimization opportunity:
vpcmpled %zmm0, %zmm1, %k0
knotw %k0, %k1

can be combine to
vpcmpgtd %zmm0, %zmm2, %k1

Reviewers:
1. delena
2. igorb

Commited after check all
Differential Revision: https://reviews.llvm.org/D27160

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289653 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx512-vec-cmp.ll