[ARM] Attempt to distribute reductions
authorDavid Green <david.green@arm.com>
Fri, 30 Jul 2021 13:48:31 +0000 (14:48 +0100)
committerDavid Green <david.green@arm.com>
Fri, 30 Jul 2021 13:48:31 +0000 (14:48 +0100)
commit532d05b714b3f64603be53398571d49a6f4b2f92
treeb382ffb5cfd07e659173c96c24d6c151016a2828
parent4ffa1478fd1bbfdea9382786c0afc4e1303bbd06
[ARM] Attempt to distribute reductions

This adds a combine for adds of reductions, distributing them so that
they occur sequentially to enable better use of accumulating VADDVA
instructions. It combines:
  add(X, add(vecreduce(Y), vecreduce(Z))) ->
    add(add(X, vecreduce(Y)), vecreduce(Z))
and
  add(add(A, reduce(B)), add(C, reduce(D))) ->
    add(add(add(A, C), reduce(B)), reduce(D))

These together distribute the add's so that more reductions can be
selected to VADDVA.

Differential Revision: https://reviews.llvm.org/D106532
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/Thumb2/mve-vaddv.ll
llvm/test/CodeGen/Thumb2/mve-vecreduce-slp.ll