https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87621
Bug ID: 87621 Summary: auto-vectorization fails for exponentiation code Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: hoganmeier at gmail dot com Target Milestone: --- https://godbolt.org/z/bgieBT template <typename T> T pow(T x, unsigned int n) { if (!n) return 1; T y = 1; while (n > 1) { if (n%2) y *= x; x = x*x; // unsupported use in stmt n /= 2; } return x*y; } void testVec(int* x) { // loop nest containing two or more consecutive inner loops cannot be vectorized for (int i = 0; i < 8; ++i) x[i] = pow(x[i], 10); }