OSDN Git Service

[X86][SSE] Consistently prefer lowering to PACKUS over PACKSS
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 8 Jun 2018 10:29:00 +0000 (10:29 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 8 Jun 2018 10:29:00 +0000 (10:29 +0000)
commit696a18d3c4f5075674e351b1c56db7393dd89da3
treeccc8781667d1f479a872c5e9c91911c1aea26240
parent3a14e8ce77b94bbc9868f2e30024b6add5e00004
[X86][SSE] Consistently prefer lowering to PACKUS over PACKSS

We have some combines/lowerings that attempt to use PACKSS-then-PACKUS and others that use PACKUS-then-PACKSS.

PACKUS is much easier to combine with if we know the upper bits are zero as ComputeKnownBits can easily see through BITCASTs etc. especially now that rL333995 and rL334007 have landed. It also effectively works at byte level which further simplifies shuffle combines.

The only (minor) annoyances are that ComputeKnownBits can sometimes take longer as it doesn't fail as quickly as ComputeNumSignBits (but I'm not seeing any actual regressions in tests) and PACKUSDW only became available after SSE41 so we have more codegen diffs between targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334276 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avg.ll
test/CodeGen/X86/prefer-avx256-mask-extend.ll
test/CodeGen/X86/vector-trunc-packus.ll
test/CodeGen/X86/vector-trunc-usat.ll
test/CodeGen/X86/vector-trunc.ll
test/CodeGen/X86/widen_arith-2.ll