[llvm] [AArch64][LV][SLP] Vectorizers use getFRemInstrCost for frem costs (PR #82488)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 06:18:46 PST 2024


alexey-bataev wrote:

> The benefits of having`getFRemInstrCost` in my view are the below:
> 
> 1. frem is a special case anyway:
>    It's an IR instruction that is not supported by all hw and targets have to specialize.
>    Handling it ~in a dedicated switch case~ with a dedicated TTI function call, clearly exposes that information to anyone who reads the code in both vectorizers (and not obscuring it away).

What's so special about it? It is absolutely fine if the target does not support it.

>    Plus it won't add any `if (TLI hasVecLib) doThis else doThat` logic to the vectorizers.
> 2. This won't be a significant API change.
>    It won't force any other user of the `getArithmeticInstrCost` to go through that change.
> 

This is not a problem at all. Instead you're adding a special API for a single instruction, which bloats the users of this API.

> Edit: I won't use a dedicate switch as I don't want to duplicate those lambdas or introduce any weird fall-throughs.



https://github.com/llvm/llvm-project/pull/82488


More information about the llvm-commits mailing list