On Mon, Mar 02, 2020 at 09:40:59PM +0000, GT wrote:
> Searching openmp.org located document "OpenMP API Examples". The relevant 
> example
> for inbranch/notinbranch shows very simple functions (SIMD.6.c). GCC testsuite
> functions are similarly simple.
> Wouldn't the same effect be achieved by letting GCC inline such functions and 
> having
> the loop autovectorizer handle the resulting code?

If it is defined in headers and inlinable, sure, then you don't need to mark
it any way.
The pragmas are mainly for functions that aren't inlinable for whatever
reason.

> > There are various tests that cover it, look e.g. at tests that require 
> > vect_simd_clones
> > effective target (e.g. in gcc/testsuite//{vect,gomp}/ and 
> > libgomp/testsuite//).
> >
> 
> Sorry, I can't identify any test that ensures a masked vector function 
> variant produces
> expected results. I'll check again but I need more help here.

Indeed, there aren't any yet on the vectorizer side, I thought I've implemented 
it
already in the vectorizer but apparently didn't, just the omp-simd-clone.c part 
is
implemented (the more important part, as it matters for the ABI).  A testcase 
could
be something along the lines of
#pragma omp declare simd
int foo (int, int);

void
bar (int *a, int *b, int *c)
{
  #pragma omp simd
  for (int i = 0; i < 1024; i++)
    {
      int d = b[i], e = c[i], f;
      if (b[i] < 20)
        f = foo (d, e);
      else
        f = d + e;
    }
}
To make this work, one would need to tweak tree-if-conv.c (invent some way
how to represent the conditional calls in the IL during the vect pass,
probably some new internal function) and then handle that in
vectorizable_simd_clone_call.

        Jakub

Reply via email to