• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN:   %clang_cc1 -fopenmp -E -o - %s 2>&1 | FileCheck %s
2 
3 // This is to make sure the pragma name is not expanded!
4 #define omp (0xDEADBEEF)
5 
6 #define N 2
7 #define M 1
8 #define E N>
9 
10 #define map_to_be_expanded(x) map(tofrom:x)
11 #define sched_to_be_expanded(x,s) schedule(x,s)
12 #define reda_to_be_expanded(x) reduction(+:x)
13 #define redb_to_be_expanded(x,op) reduction(op:x)
14 
foo(int * a,int * b)15 void foo(int *a, int *b) {
16   //CHECK: omp target map(a[0:2]) map(tofrom:b[0:2*1])
17   #pragma omp target map(a[0:N]) map_to_be_expanded(b[0:2*M])
18   {
19     int reda;
20     int redb;
21     //CHECK: omp parallel for schedule(static,2> >1) reduction(+:reda) reduction(*:redb)
22     #pragma omp parallel for sched_to_be_expanded(static, E>1) \
23         reda_to_be_expanded(reda) redb_to_be_expanded(redb,*)
24     for (int i = 0; i < N; ++i) {
25       reda += a[i];
26       redb += b[i];
27     }
28     a[0] = reda;
29     b[0] = redb;
30   }
31 }
32