brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 837fdb4 Raw
120 lines · cpp
1// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown \2// RUN:   -verify=host -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc \3// RUN:   %s -o %t-ppc-host.bc -fexceptions -fcxx-exceptions4// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown \5// RUN:   -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s \6// RUN:   -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - \7// RUN:   -fexceptions -fcxx-exceptions -ferror-limit 1008 9// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown \10// RUN:   -verify=host -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc \11// RUN:   %s -o %t-ppc-host-amd.bc -fexceptions -fcxx-exceptions12// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple amdgcn-amd-amdhsa \13// RUN:   -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s \14// RUN:   -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-amd.bc -o - \15// RUN:   -fexceptions -fcxx-exceptions -ferror-limit 10016 17// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown \18// RUN:   -verify=host -fopenmp-targets=spirv64-intel -emit-llvm-bc \19// RUN:   %s -o %t-ppc-host-spirv.bc -fexceptions -fcxx-exceptions20// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple spirv64-intel \21// RUN:   -fopenmp-targets=spirv64-intel -emit-llvm %s \22// RUN:   -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-spirv.bc -o - \23// RUN:   -fexceptions -fcxx-exceptions -ferror-limit 10024 25#ifndef HEADER26#define HEADER27 28template <typename T>29class TemplateClass {30  T a;31public:32  TemplateClass() { throw 1;}33  T f_method() const { return a; }34};35 36int foo();37 38int baz1();39 40int baz2();41 42int baz4() { return 5; }43 44template <typename T>45T FA() {46  TemplateClass<T> s;47  return s.f_method();48}49 50#pragma omp declare target51struct S {52  int a;53  S(int a) : a(a) { throw 1; } // expected-warning-re {{target '{{.*}}' does not support exception handling; 'throw' is assumed to be never reached}}54};55 56int foo() { return 0; }57int b = 15;58int d;59#pragma omp end declare target60int c;61 62int bar() { return 1 + foo() + bar() + baz1() + baz2(); } // expected-note {{called by 'bar'}}63 64int maini1() {65  int a;66  static long aa = 32;67  try {68#pragma omp target map(tofrom \69                       : a, b)70  {71    // expected-note@+1 {{called by 'maini1'}}72    S s(a);73    static long aaa = 23;74    a = foo() + bar() + b + c + d + aa + aaa + FA<int>(); // expected-note{{called by 'maini1'}}75    if (!a)76      throw "Error"; // expected-warning-re {{target '{{.*}}' does not support exception handling; 'throw' is assumed to be never reached}}77  }78  } catch(...) {79  }80  return baz4();81}82 83int baz3() { return 2 + baz2(); }84int baz2() {85#pragma omp target86  try { // expected-warning-re {{target '{{.*}}' does not support exception handling; 'catch' block is ignored}}87  ++c;88  } catch (...) {89  }90  return 2 + baz3();91}92 93int baz1() { throw 1; } // expected-warning-re {{target '{{.*}}' does not support exception handling; 'throw' is assumed to be never reached}}94 95int foobar1();96int foobar2();97 98int (*A)() = &foobar1;99#pragma omp declare target100int (*B)() = &foobar2;101#pragma omp end declare target102 103int foobar1() { throw 1; }104int foobar2() { throw 1; } // expected-warning-re {{target '{{.*}}' does not support exception handling; 'throw' is assumed to be never reached}}105 106 107int foobar3();108int (*C)() = &foobar3; // expected-warning {{declaration is not declared in any declare target region}}109                       // host-warning@-1 {{declaration is not declared in any declare target region}}110#pragma omp declare target111int (*D)() = C; // expected-note {{used here}}112                // host-note@-1 {{used here}}113#pragma omp end declare target114int foobar3() { throw 1; } // expected-warning-re {{target '{{.*}}' does not support exception handling; 'throw' is assumed to be never reached}}115 116// Check no infinite recursion in deferred diagnostic emitter.117long E = (long)&E;118 119#endif // HEADER120