SIMD c = a op b
Cecil Ward
cecil at cecilward.com
Sun Jun 18 05:01:16 UTC 2023
On Sunday, 18 June 2023 at 04:54:08 UTC, Cecil Ward wrote:
> Is it true that this doesn’t work (in either branch)?
>
> float4 a,b;
> static if (__traits(compiles, a/b))
> c = a / b;
> else
> c[] = a[] / b[];
>
> I tried it with 4 x 64-bit ulongs in a 256-bit vector instead.
> Hoping I have done things correctly, I got an error message
> about requiring a destination variable as in c = a op b where I
> tried simply "return a / b;" In the else branch, I got a type
> conversion error. Is that because a[] is an array of 256-bit
> vectors, in the else case, not an array of ulongs?
Correction I should have written ‘always work’ - I just copied
the example straight from the language documentation for simd and
adapted it to use ulongs and a wider vector.
I was using GDC.
More information about the Digitalmars-d-learn
mailing list