[PATCH] D88225: [DAG] Fold vector mul(x,0)/mul(x,1) to a clearing mask

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 06:16:31 PDT 2020


RKSimon created this revision.
RKSimon added reviewers: efriedma, spatel, craig.topper, foad, aemerson.
Herald added subscribers: ecnelises, hiraditya, kristof.beyls.
Herald added a project: LLVM.
RKSimon requested review of this revision.

If we're multiplying all elements of a vector by '0' or '1' then we can more efficiently perform this as a clearing mask (that is likely to further simplify to a shuffle blend).

This was noticed when reviewing D87502 <https://reviews.llvm.org/D87502> but seems to help idiv/irem by constant cases even more as '0'/'1' values are often used for 'passthrough' cases.

I'm not sure what to make of the aarch64 changes - replacing a fused mla with and+add seems beneficial as the mul is by far the costlier op but I might be wrong....


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88225

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AArch64/srem-seteq-vec-nonsplat.ll
  llvm/test/CodeGen/X86/srem-seteq-vec-nonsplat.ll
  llvm/test/CodeGen/X86/vector-idiv-sdiv-128.ll
  llvm/test/CodeGen/X86/vector-idiv-sdiv-256.ll
  llvm/test/CodeGen/X86/vector-idiv-sdiv-512.ll
  llvm/test/CodeGen/X86/vector-mul.ll
  llvm/test/CodeGen/X86/vector-trunc-math.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88225.294035.patch
Type: text/x-patch
Size: 117050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/4a36387b/attachment-0001.bin>


More information about the llvm-commits mailing list