i386: Fix cstorebf4 fp comparison operand [PR117495]
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-85.c
blobdb250657ac5b7e3460ba812fb37759edefad8045
1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-lcuda" } */
3 /* { dg-require-effective-target openacc_cuda } */
5 #include <stdlib.h>
6 #include <unistd.h>
7 #include <openacc.h>
8 #include <stdio.h>
9 #include <cuda.h>
11 #if !defined __cplusplus
12 # undef static_assert
13 # define static_assert _Static_assert
14 #endif
16 static_assert (acc_async_sync == -2, "acc_async_sync?");
17 static_assert (acc_async_noval == -1, "acc_async_noval?");
19 int
20 main (int argc, char **argv)
22 const int N = 100;
23 int i;
24 CUstream *streams;
25 CUstream s;
26 CUresult r;
28 acc_init (acc_device_nvidia);
30 (void) acc_get_device_num (acc_device_nvidia);
32 streams = (CUstream *) malloc ((2 + N) * sizeof (void *));
33 streams += 2;
34 /* "streams[i]" is valid for i in [acc_async_sync..N). */
36 for (i = acc_async_sync; i < N; i++)
38 streams[i] = (CUstream) acc_get_cuda_stream (i);
39 if (streams[i] != NULL)
40 abort ();
42 r = cuStreamCreate (&streams[i], CU_STREAM_DEFAULT);
43 if (r != CUDA_SUCCESS)
45 fprintf (stderr, "cuStreamCreate failed: %d\n", r);
46 abort ();
49 int ret = acc_set_cuda_stream (i, streams[i]);
50 if (i == acc_async_sync)
52 if (ret == 1)
53 abort ();
55 else
57 if (ret != 1)
58 abort ();
62 s = NULL;
64 if (acc_set_cuda_stream (N + 1, s) != 0)
65 abort ();
67 acc_shutdown (acc_device_nvidia);
69 exit (0);
72 /* { dg-output "" } */