[PATCH] D95373: Replace vector intrinsics with call to vector library

Lukas Sommer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 13:29:16 PST 2021


LukasSommerTu added a comment.

In D95373#2520441 <https://reviews.llvm.org/D95373#2520441>, @lebedev.ri wrote:

> In D95373#2520409 <https://reviews.llvm.org/D95373#2520409>, @LukasSommerTu wrote:
>
>> @lebedev.ri: Thanks for your feedback!
>>
>> My reasoning to implement this as an IR pass was that the replacement for the scalar version of the intrinsics is also happening as part of the middle-end, so it made sense to me to implement this in a similar location and use similar mechansisms.
>
> Hm, it does? That seems quite surprising to me.

Yes, `inject-tli-mappings` add the VFABI-attributes to the intrinsic calls and the loop-vectorizer performs the replacement as part of the vectorization.
For example, `%call = tail call double @llvm.sin.f64(double %conv)` will be replaced inside a loop that is vectorized by `%5 = call <4 x double> @_ZGVdN4v_sin(<4 x double> %4)` using `opt -vector-library=LIBMVEC-X86 -S -inject-tli-mappings -loop-vectorize`

More examples can be found in https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll

I get your point about placing such a transformation as last as possible in the pipeline or in the codegen, but as the Loop- and SLP-vectorizer perform a similar transformation, I thought it might be a good idea to reuse similar mechanisms and infrastructure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95373/new/

https://reviews.llvm.org/D95373



More information about the llvm-commits mailing list