auto vectorization observations

Bruce Carneal bcarneal at gmail.com
Thu Jun 9 20:32:44 UTC 2022


On Thursday, 9 June 2022 at 14:28:31 UTC, Siarhei Siamashka wrote:
> On Wednesday, 8 June 2022 at 18:41:44 UTC, Bruce Carneal wrote:
>> As an example, gdc is able to vectorize the following for both 
>> ARM SVE and x86-SIMD architectures while ldc, per my godbolt 
>> testing at least, can not.
>
> I was unable to confirm this: https://d.godbolt.org/z/Y9fEvn83e 
> (neither GDC nor LDC can vectorize it). Could you please post a 
> link to your godbolt results with the right compiler versions 
> and optimization options?

https://godbolt.org/z/1exqWT49c

The above is a link to gdc/ldc godbolt comparison with x86-64-v4 
targets. I'm not sure which subset of the v4 capabilities are 
required for gdc to vectorize the code.  It does not vectorize 
v3, so *very* recent x86s in any event.

The ARM story is similar, SVE is very recent. Note: I think I had 
to go to C equivalent code to get a godbolt visible ARM SVE 
compiler.

Auto vectorization could be the future but if you're targetting 
non-cutting-edge HW SIMT is a better bet if available and 
__vector if not.



More information about the Digitalmars-d mailing list