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

Venkataramanan Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 11 11:16:40 PDT 2020


venkataramanan.kumar.llvm added a comment.

In D88154#2314352 <https://reviews.llvm.org/D88154#2314352>, @spatel wrote:

> 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.

Ok I  see intrinsic for fp128 type in LangRef.

---Snip--
declare fp128 @llvm.cos.f128(fp128)

define fp128 @test_cos(float %float, double %double, fp128 %fp128) {

  %cosfp128 = call fp128 @llvm.cos.f128(fp128 %fp128)
  ret fp128 %cosfp128

}
--Snip--

f128  is treated a long double I see call to cosl.

  vmovaps %xmm2, %xmm0
   jmp     cosl   

so I am not sure how to generate vector calls via built-ins.


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

https://reviews.llvm.org/D88154



More information about the cfe-commits mailing list