mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-11 19:49:32 +00:00
62 lines
778 B
C
62 lines
778 B
C
/* { dg-do run { target openacc_nvidia_accel_selected } } */
|
|
|
|
#include <stdlib.h>
|
|
#include <openacc.h>
|
|
|
|
float *b;
|
|
#pragma acc declare deviceptr (b)
|
|
|
|
#pragma acc routine
|
|
float *
|
|
subr2 (void)
|
|
{
|
|
return b;
|
|
}
|
|
|
|
float
|
|
subr1 (float a)
|
|
{
|
|
float b;
|
|
#pragma acc declare present_or_copy (b)
|
|
float c;
|
|
#pragma acc declare present_or_copyin (c)
|
|
float d;
|
|
#pragma acc declare present_or_create (d)
|
|
float e;
|
|
#pragma acc declare present_or_copyout (e)
|
|
|
|
#pragma acc parallel copy (a)
|
|
{
|
|
b = a;
|
|
c = b;
|
|
d = c;
|
|
e = d;
|
|
a = e;
|
|
}
|
|
|
|
return a;
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
float a;
|
|
float *c;
|
|
|
|
a = 2.0;
|
|
|
|
a = subr1 (a);
|
|
|
|
if (a != 2.0)
|
|
abort ();
|
|
|
|
b = (float *) acc_malloc (sizeof (float));
|
|
|
|
c = subr2 ();
|
|
|
|
if (b != c)
|
|
abort ();
|
|
|
|
return 0;
|
|
}
|