109 lines · cpp
1// RUN: %clang_cc1 -DF1 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc2// RUN: %clang_cc1 -DF1 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null3// RUN: %clang_cc1 -DF2 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc4// RUN: %clang_cc1 -DF2 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null5// RUN: %clang_cc1 -DF3 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host-ppc.bc6// RUN: %clang_cc1 -DF3 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null7 8#ifndef TARGET9// expected-no-diagnostics10#endif11 12#ifdef F313template<typename tx>14tx ftemplate(int n) {15 tx a = 0;16 17#ifdef TARGET18 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}19#endif20 #pragma omp parallel num_threads(strict: tx(20)) severity(fatal) message("msg")21 {22 }23 24 short b = 1;25#ifdef TARGET26 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}27#endif28 #pragma omp parallel num_threads(strict: b) severity(warning) message("msg")29 {30 a += b;31 }32 33 return a;34}35#endif36 37#ifdef F238static39int fstatic(int n) {40 41#ifdef TARGET42 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}43#endif44 #pragma omp target parallel num_threads(strict: n) message("msg")45 {46 }47 48#ifdef TARGET49 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}50#endif51 #pragma omp target parallel num_threads(strict: 32+n) severity(warning)52 {53 }54 55 return n+1;56}57#endif58 59#ifdef F160struct S1 {61 double a;62 63 int r1(int n){64 int b = 1;65 66#ifdef TARGET67 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}68#endif69 #pragma omp parallel num_threads(strict: n-b) severity(warning) message("msg")70 {71 this->a = (double)b + 1.5;72 }73 74#ifdef TARGET75 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}76#endif77 #pragma omp parallel num_threads(strict: 1024) severity(fatal)78 {79 this->a = 2.5;80 }81 82 return (int)a;83 }84};85#endif86 87int bar(int n){88 int a = 0;89 90#ifdef F191 #pragma omp target92 {93 S1 S;94 a += S.r1(n);95 }96#endif97 98#ifdef F299 a += fstatic(n);100#endif101 102#ifdef F3103 #pragma omp target104 a += ftemplate<int>(n);105#endif106 107 return a;108}109