[DAG] matchBinOpReduction - match subvector reduction patterns beyond a matched shuff...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 4 Jul 2020 14:27:55 +0000 (15:27 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 4 Jul 2020 14:28:15 +0000 (15:28 +0100)
commit56a8a5c9fe24d6d8809313633a4a5786d4fd29c6
treef8fc79185a069969a68dc7fc0c49a74d85ac573e
parente56e96a264268a1df018f8b0a8c4caa18397a75d
[DAG] matchBinOpReduction - match subvector reduction patterns beyond a matched shufflevector reduction

Currently matchBinOpReduction only handles shufflevector reduction patterns, but in many cases these only occur in the final stages of a reduction, once we're down to legal vector widths.

Before this its likely that we are performing reductions using subvector extractions to repeatedly split the source vector in half and perform the binop on the halves.

Assuming we've found a non-partial reduction, this patch continues looking for subvector reductions as far as it can beyond the last shufflevector.

Fixes PR37890
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/horizontal-reduce-add.ll
llvm/test/CodeGen/X86/horizontal-reduce-fadd.ll