This patch considers the experimental vector reduce intrinsics in the default implementation of getIntrinsicInstrCost. The cost of these intrinsics is computed with getArithmeticReductionCost and getMinMaxReductionCost. This patch also adds a test case for AArch64 that indicates the costs we currently compute for vector reduce intrinsics. These costs are inaccurate and will be updated in a follow-on patch.
Why can't this be an extension of getIntrinsicInstrCost itself? It already has that logic (and much more)...
Also, my comments are related to further extensions of this function (if necessary), as well as for extending getIntrinsicInstrCost.
I fear we'll end up with a big list of lambdas before the actual switches, all to wrap common variables and safety asserts.
|1144 ↗||(On Diff #138437)|
these wrappers do seems cumbersome and mostly unnecessary. You could move the assert into getArithmeticReductionCost and getMinMaxReductionCost and avoid it altogether.
|1171 ↗||(On Diff #138437)|
And here you can cache the values of Args->getType(), etc. and just repeat the pattern.
Thanks a lot for taking a look at the patch, Renato! Ah, I missed the implementation of getIntrinsicInstrCost over in BasicTTIImpl.h. I agree - it definitely makes sense to move this logic there. I'll update the patch with your suggestions.