[LV] Refactor getExtendedAddReductionCost to support other extended reduction more...
authorjacquesguan <Jianjian.Guan@streamcomputing.com>
Mon, 1 Aug 2022 03:31:57 +0000 (11:31 +0800)
committerjacquesguan <Jianjian.Guan@streamcomputing.com>
Tue, 2 Aug 2022 08:02:38 +0000 (16:02 +0800)
commite38af7ba958aeb26a60b8a188596eb5762c3fde6
tree322f353523f7a0372bcd3dcc3884aec194771dc7
parent112499f35f4169f798d7f6436cf60e822b9c1da0
[LV] Refactor getExtendedAddReductionCost to support other extended reduction more than Add.

Now the API getExtendedAddReductionCost is used to determine the cost of extended Add reduction with optional Mul. For Arm, it could cover the cases. But for other target, for example: RISCV, they support other kinds of extended recution, such as FAdd.

This patch does the following changes:
1, Split getExtendedAddReductionCost into 2 new API: getExtendedReductionCost which handles the extended reduction with addtional input of Opcode; getMulAccReductionCost which handle the MLA cases the getExtendedAddReductionCost.
2, Refactor getReductionPatternCost, add some contraint condition to make sure the getMulAccReductionCost should only handle the reuction of Add + Mul.

Differential Revision: https://reviews.llvm.org/D130868
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp