Ah, that makes sense. If I had done correctly, I found the ix86_veclib_handler in i386.c which is distinct from glibc's external math-vector.h. However, is it possible/feasible to cheat gcc with '-mveclibabi' to force it do the analysis and then redirect the external call to glibc? Yifei At 2017-04-12 02:06:51, "Alexander Monakov" <amonakov@xxxxxxxxx> wrote: >On Tue, 11 Apr 2017, Yifei wrote: >> I'm wondering why gcc fails to do a straightforward optimization? And how can >> I do, as a work around, to avoid writing an explicit loop? > >(note, the example is vectorized with -mveclibabi={acml,svml}, but then it >requires the corresponding external library and -ffast-math) > >Without -mveclibabi, this works for loop vectorization with recent Glibc, >because it provides vectorized implementations in libmvec and has >__attribute__((simd)) on a few math functions. > >However, using SIMD clones in SLP vectorization is currently not implemented >(veclib calls and SIMD clones are handled via different paths) > >Alexander