46dbeb4085
2018-03-26 Tom de Vries <tom@codesourcery.com> PR tree-optimization/85063 * omp-general.c (offloading_function_p): New function. Factor out of ... * omp-offload.c (pass_omp_target_link::gate): ... here. * omp-general.h (offloading_function_p): Declare. * tree-switch-conversion.c (build_one_array): Mark CSWTCH.x variable with attribute omp declare target for offloading functions. * testsuite/libgomp.c/switch-conversion-2.c: New test. * testsuite/libgomp.c/switch-conversion.c: New test. * testsuite/libgomp.oacc-c-c++-common/switch-conversion-2.c: New test. * testsuite/libgomp.oacc-c-c++-common/switch-conversion.c: New test. From-SVN: r258852
32 lines
416 B
C
32 lines
416 B
C
/* PR tree-optimization/85063 */
|
|
/* { dg-additional-options "-ftree-switch-conversion" } */
|
|
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int n[1];
|
|
|
|
n[0] = 3;
|
|
|
|
#pragma acc parallel copy(n)
|
|
{
|
|
int m = n[0];
|
|
switch (m & 3)
|
|
{
|
|
case 0: m = 4; break;
|
|
case 1: m = 3; break;
|
|
case 2: m = 2; break;
|
|
default:
|
|
m = 1; break;
|
|
}
|
|
n[0] = m;
|
|
}
|
|
|
|
if (n[0] != 1)
|
|
abort ();
|
|
|
|
return 0;
|
|
}
|