diff options
| author | Samuel Antao <sfantao@us.ibm.com> | 2015-06-15 23:44:27 +0000 |
|---|---|---|
| committer | Samuel Antao <sfantao@us.ibm.com> | 2015-06-15 23:44:27 +0000 |
| commit | eab747b9f5d4b6f44a4fa0151b3f9339b6cd564a (patch) | |
| tree | ce4649e165a1886583419afe5d1f55d5948dbd62 /clang/test/Preprocessor | |
| parent | 72bfb8e234af86f2a9d2b30e5a98d47a4400ba1a (diff) | |
| download | bcm5719-llvm-eab747b9f5d4b6f44a4fa0151b3f9339b6cd564a.tar.gz bcm5719-llvm-eab747b9f5d4b6f44a4fa0151b3f9339b6cd564a.zip | |
According to the OpenMP spec, all the preprocessor macros should be
expanded in OpenMP pragmas. This patch adds support for that in -E.
llvm-svn: 239784
Diffstat (limited to 'clang/test/Preprocessor')
| -rw-r--r-- | clang/test/Preprocessor/openmp-macro-expansion.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/openmp-macro-expansion.c b/clang/test/Preprocessor/openmp-macro-expansion.c new file mode 100644 index 00000000000..a83512b5920 --- /dev/null +++ b/clang/test/Preprocessor/openmp-macro-expansion.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fopenmp -E -o - %s 2>&1 | FileCheck %s + +// This is to make sure the pragma name is not expanded! +#define omp (0xDEADBEEF) + +#define N 2 +#define M 1 +#define E N> + +#define map_to_be_expanded(x) map(tofrom:x) +#define sched_to_be_expanded(x,s) schedule(x,s) +#define reda_to_be_expanded(x) reduction(+:x) +#define redb_to_be_expanded(x,op) reduction(op:x) + +void foo(int *a, int *b) { + //CHECK: omp target map(a[0:2]) map(tofrom:b[0:2*1]) + #pragma omp target map(a[0:N]) map_to_be_expanded(b[0:2*M]) + { + int reda; + int redb; + //CHECK: omp parallel for schedule(static,2> >1) reduction(+:reda) reduction(*:redb) + #pragma omp parallel for sched_to_be_expanded(static, E>1) \ + reda_to_be_expanded(reda) redb_to_be_expanded(redb,*) + for (int i = 0; i < N; ++i) { + reda += a[i]; + redb += b[i]; + } + a[0] = reda; + b[0] = redb; + } +} |

