[X86] Prefer KORTEST on Knights Landing or later for memcmp()
authorDavid Zarzycki <dave@znu.io>
Thu, 17 Oct 2019 09:38:15 +0000 (12:38 +0300)
committerDavid Zarzycki <dave@znu.io>
Sat, 26 Oct 2019 18:14:57 +0000 (21:14 +0300)
commit11c920207afa92ad13fdf72daba14c9af336293a
tree2b671d2e7bf21a89616cd8a78603d3b1fd46be53
parent0d0509384f054cb4f13260786ee48163ac94d123
[X86] Prefer KORTEST on Knights Landing or later for memcmp()

PTEST and especially the MOVMSK instructions are slow on Knights Landing
or later. As a bonus, this patch increases instruction parallelism by
emitting:
    KORTEST(PCMPNEQ(a, b), PCMPNEQ(c, d)) == 0
Instead of:
    KORTEST(AND(PCMPEQ(a, b), PCMPEQ(c, d))) == ~0

https://reviews.llvm.org/D69157
llvm/lib/Target/X86/X86.td
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86Subtarget.h
llvm/lib/Target/X86/X86TargetTransformInfo.h
llvm/test/CodeGen/X86/memcmp.ll
llvm/test/CodeGen/X86/setcc-wide-types.ll