vectorization of a simple loop -- not in DMD?
Bruce Carneal
bcarneal at gmail.com
Mon Jul 11 20:01:50 UTC 2022
On Monday, 11 July 2022 at 18:15:16 UTC, Ivan Kazmenko wrote:
> Hi.
>
> I'm looking at the compiler output of DMD (-O -release), LDC
> (-O -release), and GDC (-O3) for a simple array operation:
>
> ```
> void add1 (int [] a)
> {
> foreach (i; 0..a.length)
> a[i] += 1;
> }
> ```
>
> Here are the outputs: https://godbolt.org/z/GcznbjEaf
>
> From what I gather at the view linked above, DMD does not use
> XMM registers for speedup, and does not unroll the loop either.
[snip]
Specifying a SIMD capable target will reveal an even wider gap in
capability. (LDC -mcpu=x86-64-v3 or gdc -march=x86-64-v3).
More information about the Digitalmars-d-learn
mailing list