vectorization of a simple loop -- not in DMD?
Ivan Kazmenko
gassa at mail.ru
Mon Jul 11 18:15:16 UTC 2022
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.
Switching between 32bit and 64bit doesn't help either. However,
I recall in the past it was capable of at least some of these
optimizations. So, how do I enable them for such a function?
Ivan Kazmenko.
More information about the Digitalmars-d-learn
mailing list