Do you think if statement as expression would be nice to have in D?

Guillaume Piolat first.last at gmail.com
Tue Jun 7 23:58:20 UTC 2022


On Tuesday, 7 June 2022 at 23:36:20 UTC, Guillaume Piolat wrote:
> On Tuesday, 7 June 2022 at 22:22:22 UTC, max haughton wrote:
>>
>> Which instructions are they supposed to lower to? Wouldn't 
>> that require the intrinsic-in-name-only intel math library 
>> stuff?
>
> I've ony seen that with Intel C++ compiler => 
> https://godbolt.org/z/E39rc77fj
>
> It will replace transcendental function with a vectorized 
> version that does 4 log/exp/pow/sin/cos at once, and yes that 
> is faster.

In LLVM, builtins that map to instructions that can be done with 
normal code are eventually removed.

However, some of them stay forever in ldc.gcc_builtinsx86 (it has 
894 builtins) because you can't cause the codegen to generate 
them else.

For example it is impossible to have PMADDWD otherwise in LLVM.
https://d.godbolt.org/z/vvqP5vzvo

But, Intel C++ compiler can do it:
https://godbolt.org/z/f37dzKzT3

that's why intel-intrinsics exist, not all autovectorizers are 
created equals.



More information about the Digitalmars-d mailing list