gcc/libgomp/testsuite/libgomp.c/uns-outer-4.c
Tom de Vries 12efb1d75f Handle double reduction in parloops
2015-07-28  Tom de Vries  <tom@codesourcery.com>

	* tree-parloops.c (reduc_stmt_res): New function.
	(initialize_reductions, add_field_for_reduction)
	(create_phi_for_local_result, create_loads_for_reductions)
	(create_stores_for_reduction, build_new_reduction): Handle case that
	reduc_stmt is a phi.
	(gather_scalar_reductions): Allow double_reduc reductions.

	* gcc.dg/autopar/uns-outer-4.c: Remove xfail on scan for parallelizing
	outer loop.

	* testsuite/libgomp.c/uns-outer-4.c: New test.

From-SVN: r226300
2015-07-28 07:54:04 +00:00

37 lines
520 B
C

/* { dg-do run } */
/* { dg-additional-options "-ftree-parallelize-loops=2" } */
void abort (void);
unsigned int g_sum = 1;
unsigned int x[500][500];
void __attribute__((noinline,noclone))
parloop (int N)
{
int i, j;
unsigned int sum;
/* Double reduction is detected, outer loop is parallelized. */
sum = 0;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
sum += x[i][j];
g_sum = sum;
}
int
main (void)
{
x[234][432] = 2;
parloop (500);
if (g_sum != 2)
abort ();
return 0;
}