How to use math functions in dcompute?

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Sep 20 12:43:02 UTC 2018


On Thursday, 20 September 2018 at 05:16:04 UTC, Sobaya wrote:
> On Wednesday, 19 September 2018 at 00:22:44 UTC, Nicholas 
> Wilson wrote:
>> On Wednesday, 19 September 2018 at 00:11:13 UTC, Nicholas 
>> Wilson wrote:
>>> On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote:
>>>> On Tuesday, 18 September 2018 at 01:39:51 UTC, Nicholas 
>>>> Wilson wrote:
>>>>> On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote:
>>>>>> I'm waiting for the update. How's your progress?
>>>>>
>>>>> I t appears I have broke SPIR-V completely somewhere along 
>>>>> the line, I may release a v0.2 with out it, hopefully 
>>>>> within the week.
>>>>
>>>> I declared like:
>>>>
>>>> pragma(LDC_intrinsic, "llvm.nvvm.cos.f32")
>>>> T cos(T)(T val)
>>>>     if (__traits(isFloating, T));
>>>>
>>>> It also doesn't work.
>>>
>>>  pragma(LDC_intrinsic, "llvm.nvvm.cos.f#") // note the # in 
>>> place of 32
>>> T cos(T)(T val)
>>>      if (__traits(isFloating, T));
>>> (Just don't use real with it.)
>>>
>>> OR
>>>
>>> pragma(LDC_intrinsic, "llvm.nvvm.cos.f32")
>>>  float cos(float val)
>>
>> And if they don't work, use
>>
>>>  pragma(LDC_intrinsic, "llvm.cos.f#") // note the # in place 
>>> of 32
>>> T cos(T)(T val)
>>>      if (__traits(isFloating, T));
>>> (Just don't use real with it.)
>
> "llvm.nvvm.cos.f#" and "llvm.nvvm.cos.f32" don't work.
>
> And when I use "llvm.cos.f#", Another error occurred in linking.
>
> LLVM ERROR: Cannot select: 0xe0d4798: f32 = fcos 
> ConstantFP:f32<0.000000e+00>
>   0xe0b9db0: f32 = ConstantFP<0.000000e+00>

Hmm, I can reproduce. Will look into it.


More information about the Digitalmars-d-learn mailing list