[PATCH] D88154: Initial support for vectorization using Libmvec (GLIBC vector math library).

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 06:59:35 PDT 2020


spatel added a comment.

In D88154#2310653 <https://reviews.llvm.org/D88154#2310653>, @venkataramanan.kumar.llvm wrote:

> In D88154#2290205 <https://reviews.llvm.org/D88154#2290205>, @abique wrote:
>
>> Looks good to me.
>> Regarding the tests, it seems that you check if auto-vectorization takes advantages of libmvec?
>> Would it be interesting to have a test which declares a vector and call the builtin sin on it?
>>
>> Thank you very much for the changes! :)
>
> do we we have built-in support for sin that takes vector types?
>
> I tried
>
> __m128d compute_sin(__m128d x)
> {
>
>   return __builtin_sin(x);
>
> }
>
>>> error: passing '__m128d' (vector of 2 'double' values) to parameter of incompatible type 'double'

We have LLVM intrinsics for sin/cos that may use vector types:
http://llvm.org/docs/LangRef.html#llvm-sin-intrinsic
...but I don't know of a way to produce those directly from C source.



================
Comment at: llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll:1
+; RUN: opt -vector-library=LIBMVEC  -inject-tli-mappings -force-vector-width=4 -force-vector-interleave=1 -loop-vectorize -S < %s | FileCheck %s
+
----------------
Why does this test file use command-line options to specify the vector factor and the other uses metadata?
If we can use metadata, then can you vary it to get better coverage (for example <2 x double> or <8 x float>)?


================
Comment at: llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll:221-224
+; CHECK-LABEL: @exp_f32_intrin
+; CHECK: <4 x float> @_ZGVbN4v_expf
+; CHECK: ret
+
----------------
It would be better to consistently put the FileCheck lines after the 'define'.
Can you auto-generate the CHECK lines using  llvm/utils/update_test_checks.py ?


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

https://reviews.llvm.org/D88154



More information about the cfe-commits mailing list