[PATCH] D111571: [X86] `detectAVGPattern()`: support basic case of PAVG chaining (PR52131)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 11 11:55:32 PDT 2021


lebedev.ri created this revision.
lebedev.ri added reviewers: RKSimon, spatel, abadams.
lebedev.ri added a project: LLVM.
Herald added subscribers: pengfei, hiraditya.
lebedev.ri requested review of this revision.

As noted in https://github.com/halide/Halide/pull/6302,
we hilariously fail to match PAVG if we even as much
as look at it the wrong way.

In this particular case, the problem stems from the fact that
`PAVG` root (def) is a `trunc`, and leafs (uses) are `zext`'s,
and InstCombine really loves to get rid of both of these,
for example replace them with a bit mask. So we may not have
said `zext`.

Instead of checking for that + type match,
i think we should rely on the actual active type,
as per the knownbits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111571

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111571.378750.patch
Type: text/x-patch
Size: 7727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/69e7a8bd/attachment.bin>


More information about the llvm-commits mailing list