[Bug tree-optimization/77689] New: Missing vectorization lead to huge performance loss
morandidodo at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 22 10:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77689
Bug ID: 77689
Summary: Missing vectorization lead to huge performance loss
Product: gcc
Version: 6.2.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: morandidodo at gmail dot com
Target Milestone: ---
Created attachment 39673
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39673&action=edit
Asm code of the main, generated by gcc and icc
I recently started using auto-vectorization as much as possible. Unfortunately,
I discovered that gcc is often unable to vectorize code.
I wrote a very simple MWE which (unfortunately, from my point of view) performs
around 11X faster if compiled with icc instead of gcc.
Here is the code:
#include <vector>
#include <cmath>
constexpr unsigned s = 100000000;
int main()
{
std::vector<float> a, b, c;
a.reserve(s);
b.reserve(s);
c.reserve(s);
for(unsigned i = 0; i < s; ++i)
{
if(i == 0)
a[i] = b[i] * c[i];
else
a[i] = (b[i] + c[i]) * c[i-1] * std::log(i);
}
}
I attach the generated assembly with both compiler. I hope that it could help
someone try improving the vectorization procedures.
More information about the Gcc-bugs
mailing list