Re: Making code auto vectorizable

On Tue, 2 May 2006, Stefan Westerfeld wrote:


On Tue, Apr 18, 2006 at 05:51:52PM +0200, Tim Janik wrote:

which is not (currently) recognized by the tree vectorizer. Rewriting
the loop without this construct, like this:

int i;
for (i = 0; i < n_values; i++)
  output[i] = input[i];

leads to a vectorizable loop. Note that this only works if i is signed,
so using a guint for iterating does not enable vectorization (it took me
quite some trial and error to figure that out).

what compiler version is this?
does the guint/gint problem persist in gcc-4.2snapshot?

Yes, it does. And there is another change in gcc-snapshot: it doesn't
vectorize the loop any more, unless __restrict__ is used to declare that
the input and output buffer don't have a data dependency. I've updated
my patch accordingly.

the rest looks good. provided it has been properly tested,
this can go into CVS. do we have a feature test for BseAdder

We do have a feature test and it still passes with the vectorized loop.
Should I commit the updated patch with the __restrict__ keyword added?
It might be necessary to look whether the compiler has support for it.

no, first, we should define "restrict" to __restrict__ if it is supported
and to nothing otherwise. and second, the bseadder code could be rewritten
in terms of bse_block_copy_float() and bse_block_add_floats(), right?
then, we should use that instead.

  Cu... Stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]