Am 27.11.2013 08:22, schrieb Sergey Ostanevich:
Done.


Thanks for fixing Richard's and Jakub's comments and parts of mine.

+have the same meaning as described in @option{fvect-cost-model} and by
+default a cost model defined with @option{fvect-cost-model} is used.
As mentioned before, pleae add a hyphen before fvect (i.e. "@option{fvect-cost-model}" -> "@option{-fvect-cost-model}")

Regarding a test case: I still think it would be useful to have one, but I somehow seemed 
to have messed up with my previous one - I fail to get it not to vectorize with "omp 
simd" due to cost reasons. Thus, I don't have one.

Tobias

/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fopenmp-simd -Wopenmp-simd -mno-sse2" } */

/* NOTE: Without -mno-sse2, the loop is vectorized.  */

#include <stdarg.h>
#include "../../tree-vect.h"

#define N 32

struct t{
  int k[N];
  int l; 
};
  
struct s{
  char a;	/* aligned */
  char b[N-1];  /* unaligned (offset 1B) */
  char c[N];    /* aligned (offset NB) */
  struct t d;   /* aligned (offset 2NB) */
  struct t e;   /* unaligned (offset 2N+4N+4 B) */
};
 
struct s tmp = { 1 };

int main1 ()
{  
  int i;

  /* unaligned */
#pragma omp simd
  for (i = 0; i < N/2; i++)
    {
      tmp.b[i] = 5; /* { dg-warning "vectorization did not happen for a simd loop" } */
    }

  /* check results:  */
  for (i = 0; i <N/2; i++)
    {
      if (tmp.b[i] != 5)
        abort ();
    }

  return 0;
}

int main (void)
{ 
  check_vect ();
  
  return main1 ();
} 

/* { dg-final { scan-tree-dump-times "loop vectorized" 0 "vect" } } */
/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } } */
/* ! dg-final ! cleanup-tree-dump "vect" ! ! */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fopenmp-simd -Wopenmp-simd -fsimd-cost-model=unlimited" } */

#include <stdarg.h>
#include "../../tree-vect.h"

#define N 32

struct t{
  int k[N];
  int l; 
};
  
struct s{
  char a;	/* aligned */
  char b[N-1];  /* unaligned (offset 1B) */
  char c[N];    /* aligned (offset NB) */
  struct t d;   /* aligned (offset 2NB) */
  struct t e;   /* unaligned (offset 2N+4N+4 B) */
};
 
struct s tmp = { 1 };

int main1 ()
{  
  int i;

  /* unaligned */
#pragma omp simd
  for (i = 0; i < N/2; i++)
    {
      tmp.b[i] = 5; /* dg-warning "vectorization did not happen for a simd loop" */
    }

  /* check results:  */
  for (i = 0; i <N/2; i++)
    {
      if (tmp.b[i] != 5)
        abort ();
    }

  return 0;
}

int main (void)
{ 
  check_vect ();
  
  return main1 ();
} 

/* { dg-final { scan-tree-dump-times "loop vectorized" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */

Reply via email to