gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c
Tom de Vries 9390f91687 [libgomp, testsuite, openacc] Remove -foffload=-w in reduction-[1-5].c
Before the commit "[libgomp, testsuite, openacc] Don't use const int for
dimensions", the "const int" construct was used to set launch dimensions in
reductions-[1-5].c.  In the case of -xc -O0, the const int is implemented as a
variable by the C front-end.  Consequently, the nvptx back-end generated
warnings that vector_length was overridden to be hard-coded, rather than left to
be set at runtime.  The test-cases silenced these warnings by switching off all
warnings in the accelerator compiler using "-foffload=-w".

Given that no warnings occur anymore, remove the "-foffload=-w" setting.

2019-01-11  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Remove
	-foffload=-w.
	* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Same.

From-SVN: r267836
2019-01-11 11:46:06 +00:00

55 lines
1.1 KiB
C

/* { dg-do run } */
/* { dg-additional-options "-w" } */
/* Multiple reductions. */
#include <stdio.h>
#include <stdlib.h>
#define ng 8
#define nw 4
#define vl 32
const int n = 100;
#define DO_PRAGMA(x) _Pragma (#x)
#define check_reduction(gwv_par, gwv_loop) \
{ \
s1 = 2; s2 = 5; \
DO_PRAGMA (acc parallel gwv_par copy (s1, s2)) \
DO_PRAGMA (acc loop gwv_loop reduction (+:s1, s2)) \
for (i = 0; i < n; i++) \
{ \
s1 = s1 + 3; \
s2 = s2 + 5; \
} \
\
if (s1 != v1 && s2 != v2) \
abort (); \
}
int
main (void)
{
int s1 = 2, s2 = 5, v1 = 2, v2 = 5;
int i;
for (i = 0; i < n; i++)
{
v1 = v1 + 3;
v2 = v2 + 2;
}
check_reduction (num_gangs (ng), gang);
/* Nvptx targets require a vector_length or 32 in to allow spinlocks with
gangs. */
check_reduction (num_workers (nw) vector_length (vl), worker);
check_reduction (vector_length (vl), vector);
check_reduction (num_gangs (ng) num_workers (nw) vector_length (vl), gang
worker vector);
return 0;
}