OSDN Git Service

[X86][SSE] Canonicalize OR(AND(X,C),AND(Y,~C)) -> OR(AND(X,C),ANDNP(C,Y))
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 22 Jan 2019 13:44:49 +0000 (13:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 22 Jan 2019 13:44:49 +0000 (13:44 +0000)
commit703b8276a240d69112d7e9a6dedd030b0844816d
tree44b6be9cea93e1c158bad175355ea8eed8623a2c
parentcf74016e108659df02f081c8f876441d15e78d19
[X86][SSE] Canonicalize OR(AND(X,C),AND(Y,~C)) -> OR(AND(X,C),ANDNP(C,Y))

For constant bit select patterns, replace one AND with a ANDNP, allowing us to reuse the constant mask. Only do this if the mask has multiple uses (to avoid losing load folding) or if we have XOP as its VPCMOV can handle most folding commutations.

This also requires computeKnownBitsForTargetNode support for X86ISD::ANDNP and X86ISD::FOR to prevent regressions in fabs/fcopysign patterns.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351819 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/bitreverse.ll
test/CodeGen/X86/combine-bitselect.ll
test/CodeGen/X86/combine-fcopysign.ll
test/CodeGen/X86/vec-copysign.ll
test/CodeGen/X86/vector-bitreverse.ll
test/CodeGen/X86/vector-fshl-256.ll
test/CodeGen/X86/vector-fshl-512.ll
test/CodeGen/X86/vector-fshl-rot-256.ll
test/CodeGen/X86/vector-fshl-rot-512.ll
test/CodeGen/X86/vector-fshr-256.ll
test/CodeGen/X86/vector-fshr-512.ll
test/CodeGen/X86/vector-fshr-rot-256.ll
test/CodeGen/X86/vector-fshr-rot-512.ll
test/CodeGen/X86/vector-rotate-256.ll
test/CodeGen/X86/vector-rotate-512.ll