[PATCH] D113371: [X86] combinePMULH - recognise 'cheap' trunctions via PACKS/PACKUS as well as SEXT/ZEXT

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 7 14:01:27 PST 2021


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

combinePMULH currently only truncates vXi32/vXi64 multiplies to PMULHW/PMULUW if the source operands are SEXT/ZEXT instructions for a 'free' truncation.

But we can generalize this to any source operand with sufficient leading sign/zero bits that would allow PACKS/PACKUS to be used as a 'cheap' truncation.

This helps us avoid the wider multiplies, in exchange for truncation on both source operands instead of the result.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113371

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113371.385372.patch
Type: text/x-patch
Size: 22755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211107/fc21b398/attachment.bin>


More information about the llvm-commits mailing list