On Wednesday 25 July 2012, Richard Guenther wrote: > On Wed, Jul 25, 2012 at 4:25 PM, Allan Sandfeld Jensen > > <carew...@gmail.com> wrote: > > On Wednesday 25 July 2012, Richard Guenther wrote: > >> On Wed, Jul 25, 2012 at 2:23 PM, Allan Sandfeld Jensen > >> > >> <carew...@gmail.com> wrote: > >> > Hi, > >> > > >> > I have been experimenting with marking specific functions to be auto- > >> > vectorized in GCC, but have had problems getting it to work. > >> > > >> > It seems the optimize attribute works sometimes, but only if the > >> > function it is used on is not static, but pragma optimize never seems > >> > to work. > >> > > >> > See the attached test-case. If you compile it with > >> > -ftree-vectorizer-verbose, you will see that only the first function > >> > is vectorized, but the two last are not. > >> > > >> > Anyone know what is wrong here? > >> > >> The attribute doesn't work in the face of inlining and generally was > >> designed for debugging, not for controlling things like you do. > > > > In that case the GCC manual should probably be updated to reflect that. > > If what you say it true, it seems it has been developed for one purpose > > but then documented for another. (The documentation needs updating > > anyway, since the attribute is no longer allowed after the function > > declaration like all the examples does, but only before). > > > > I found the problem with pragma though, it is apparently a long standing > > bug in PR 48026 and a related version in PR 41201. The last bug actually > > has a patch for the problem, it is apparently caused by an incorrect > > short-cut. > > CCing the original author. > Cool.
Anyway, for my usecase of these flags, you can see: https://bugs.webkit.org/show_bug.cgi?id=92249 It uses the optimize attribute currently, because pragma didn't work, and forces noinline so that the attribute is not lost on inline. `Allan