[PATCH] D65047: [DAGCombine] matchBinOpReduction - add partial reduction matching

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 03:41:56 PDT 2019


RKSimon created this revision.
RKSimon added reviewers: spatel, craig.topper, lebedev.ri.
Herald added a project: LLVM.

This patch adds support for recognising cases where a larger vector type is being used to reduce just the elements in the lower subvector:

e.g. <8 x i32> reduction pattern in a <16 x i32> vector:

  <4,5,6,7,u,u,u,u,u,u,u,u,u,u,u,u>
  <2,3,u,u,u,u,u,u,u,u,u,u,u,u,u,u>
  <1,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u>

matchBinOpReduction returns the lower extracted subvector in such cases, assuming isExtractSubvectorCheap accepts the extraction.

I've only enabled it for X86 reduction sums so far. I intend to enable it for the bitop/minmax cases in future patches, and eventually I think its worth turning it on all the time. This is mainly just a case of ensuring calls to matchBinOpReduction don't make assumptions on the vector width based on the original vector extraction.

Fixes the x86 partial reduction sum cases in PR33758 and PR42023.


Repository:
  rL LLVM

https://reviews.llvm.org/D65047

Files:
  include/llvm/CodeGen/SelectionDAG.h
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/phaddsub-extract.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65047.210987.patch
Type: text/x-patch
Size: 15211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190721/f0e1907a/attachment.bin>


More information about the llvm-commits mailing list