| 1 |
// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=51 -triple x86_64 \ |
| 2 |
// RUN: -emit-llvm -o - %s | FileCheck %s |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-version=51 \ |
| 5 |
// RUN: -debug-info-kind=limited -triple x86_64 -emit-llvm -o - %s | \ |
| 6 |
// RUN: FileCheck --check-prefix SIMD %s |
| 7 |
|
| 8 |
//CHECK: @.str = private unnamed_addr constant [23 x i8] c"GPU compiler required.\00", align 1 |
| 9 |
//CHECK: @0 = private unnamed_addr constant {{.*}}error_codegen.cpp;main;52;1;;\00", align 1 |
| 10 |
//CHECK: @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 {{.*}}, ptr @0 }, align 8 |
| 11 |
//CHECK: @.str.1 = private unnamed_addr constant [27 x i8] c"Note this is functioncall.\00", align 1 |
| 12 |
//CHECK: @2 = private unnamed_addr constant {{.*}}error_codegen.cpp;main;54;1;;\00", align 1 |
| 13 |
//CHECK: @3 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 {{.*}}, ptr @2 }, align 8 |
| 14 |
//CHECK: @.str.2 = private unnamed_addr constant [23 x i8] c"GNU compiler required.\00", align 1 |
| 15 |
//CHECK: @4 = private unnamed_addr constant {{.*}}error_codegen.cpp;tmain;29;1;;\00", align 1 |
| 16 |
//CHECK: @5 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 {{.*}}, ptr @4 }, align 8 |
| 17 |
//CHECK: @.str.3 = private unnamed_addr constant [22 x i8] c"Notice: add for loop.\00", align 1 |
| 18 |
//CHECK: @6 = private unnamed_addr constant {{.*}}error_codegen.cpp;tmain;32;1;;\00", align 1 |
| 19 |
//CHECK: @7 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 {{.*}}, ptr @6 }, align 8 |
| 20 |
//CHECK: @8 = private unnamed_addr constant {{.*}}error_codegen.cpp;tmain;38;1;;\00", align 1 |
| 21 |
//CHECK: @9 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 {{.*}}, ptr @8 }, align 8 |
| 22 |
|
| 23 |
void foo() {} |
| 24 |
|
| 25 |
template <typename T, int N> |
| 26 |
int tmain(T argc, char **argv) { |
| 27 |
T b = argc, c, d, e, f, g; |
| 28 |
static int a; |
| 29 |
#pragma omp error at(execution) severity(fatal) message("GNU compiler required.") |
| 30 |
a = argv[0][0]; |
| 31 |
++a; |
| 32 |
#pragma omp error at(execution) severity(warning) message("Notice: add for loop.") |
| 33 |
{ |
| 34 |
int b = 10; |
| 35 |
T c = 100; |
| 36 |
a = b + c; |
| 37 |
} |
| 38 |
#pragma omp error at(execution) severity(fatal) message("GPU compiler required.") |
| 39 |
foo(); |
| 40 |
return N; |
| 41 |
} |
| 42 |
// CHECK-LABEL: @main( |
| 43 |
// SIMD-LABEL: @main( |
| 44 |
// CHECK: call void @__kmpc_error(ptr @1, i32 2, ptr @.str) |
| 45 |
// SIMD-NOT: call void @__kmpc_error(ptr @1, i32 2, ptr @.str) |
| 46 |
// CHECK: call void @__kmpc_error(ptr @3, i32 1, ptr @.str.1) |
| 47 |
// SIMD-NOT: call void @__kmpc_error(ptr @3, i32 1, ptr @.str.1) |
| 48 |
// |
| 49 |
int main (int argc, char **argv) { |
| 50 |
int b = argc, c, d, e, f, g; |
| 51 |
static int a; |
| 52 |
#pragma omp error at(execution) severity(fatal) message("GPU compiler required.") |
| 53 |
a=2; |
| 54 |
#pragma omp error at(execution) severity(warning) message("Note this is functioncall.") |
| 55 |
foo(); |
| 56 |
tmain<int, 10>(argc, argv); |
| 57 |
} |
| 58 |
|
| 59 |
//CHECK-LABEL: @_Z5tmainIiLi10EEiT_PPc( |
| 60 |
//SIMD-LABEL: @_Z5tmainIiLi10EEiT_PPc( |
| 61 |
//CHECK: call void @__kmpc_error(ptr @5, i32 2, ptr @.str.2) |
| 62 |
//CHECK: call void @__kmpc_error(ptr @7, i32 1, ptr @.str.3) |
| 63 |
//CHECK: call void @__kmpc_error(ptr @9, i32 2, ptr @.str) |
| 64 |
//SIMD-NOT: call void @__kmpc_error(ptr @5, i32 2, ptr @.str.2) |
| 65 |
//SIMD-NOT: call void @__kmpc_error(ptr @7, i32 1, ptr @.str.3) |
| 66 |
//SIMD-NOT: call void @__kmpc_error(ptr @9, i32 2, ptr @.str) |
| 67 |
//CHECK: ret i32 10 |