[PATCH] D42817: [X86] Add support creating KORTEST/KTEST from icmp+bitcast+or/and

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 14:14:42 PST 2018


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon, zvi, delena.

Currently we only create KTEST with the same argument twice. We don't try to find any ANDs or ORs.

This patch changes lowering to produce X86ISD::KTESTREG which represents just the flag setting behavior of KTEST/KORTEST. We now use this where we previously duplicated the operand. Isel now has patterns to look for this node with and/or to create KTEST/KORTEST. If we fail to match that, just fail back to using a KORTEST with both operands the same. KORTEST is chosen because KORTESTW is available in avx512f while KTESTW requires avx512dq.

This also updates the KORTEST intrinsic lowering to use an OR+X86ISD::KTESTREG. I'll probably look into changing the builtin to create the or+bitcast+icmp in clang and deprecrate the backend intrinsic.


https://reviews.llvm.org/D42817

Files:
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Target/X86/X86InstrAVX512.td
  lib/Target/X86/X86InstrFragmentsSIMD.td
  test/CodeGen/X86/avx512-mask-op.ll
  test/CodeGen/X86/avx512-schedule.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42817.132471.patch
Type: text/x-patch
Size: 11122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/79e7c7f6/attachment.bin>


More information about the llvm-commits mailing list