1 // expected-no-diagnostics 2 #ifndef HEADER 3 #define HEADER 4 5 ///==========================================================================/// 6 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 7 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s 8 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 9 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 10 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s 11 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 12 13 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 14 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s 15 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 16 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 17 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s 18 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 19 20 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 21 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s 22 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 23 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 24 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s 25 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 26 27 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s 28 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s 29 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp-simd -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s 30 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s 31 // RUN: %clang_cc1 -no-opaque-pointers -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s 32 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp-simd -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s 33 // SIMD-ONLY24-NOT: {{__kmpc|__tgt}} 34 #ifdef CK25 35 // CK25: [[ST:%.+]] = type { i32, float } 36 // CK25: [[CA00:%.+]] = type { [[ST]]* } 37 // CK25: [[CA01:%.+]] = type { i32* } 38 39 // CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 40 // CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] 41 // CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33] 42 43 // CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 44 // CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4] 45 // CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] 46 47 // CK25-LABEL: explicit_maps_with_inner_lambda{{.*}}( 48 49 template <int X, typename T> 50 struct CC { 51 T A; 52 float B; 53 54 int foo(T arg) { 55 // Region 00 56 // CK25-DAG: call i32 @__tgt_target_kernel(%struct.ident_t* @{{.+}}, i64 -1, i32 -1, i32 0, i8* @.{{.+}}.region_id, %struct.__tgt_kernel_arguments* [[ARGS:%.+]]) 57 // CK25-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2 58 // CK25-DAG: store i8** [[BPGEP:%.+]], i8*** [[BPARG]] 59 // CK25-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3 60 // CK25-DAG: store i8** [[PGEP:%.+]], i8*** [[PARG]] 61 // CK25-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 62 // CK25-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 63 64 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 65 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 66 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** 67 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** 68 // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] 69 // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] 70 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0 71 72 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}) 73 #pragma omp target map(to \ 74 : A) 75 { 76 [&]() { 77 A += 1; 78 }(); 79 } 80 81 // Region 01 82 // CK25-DAG: call i32 @__tgt_target_kernel(%struct.ident_t* @{{.+}}, i64 -1, i32 -1, i32 0, i8* @.{{.+}}.region_id, %struct.__tgt_kernel_arguments* [[ARGS:%.+]]) 83 // CK25-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2 84 // CK25-DAG: store i8** [[BPGEP:%.+]], i8*** [[BPARG]] 85 // CK25-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3 86 // CK25-DAG: store i8** [[PGEP:%.+]], i8*** [[PARG]] 87 // CK25-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 88 // CK25-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 89 90 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 91 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 92 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** 93 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** 94 // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] 95 // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]] 96 97 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}}) 98 #pragma omp target map(to \ 99 : arg) 100 { 101 [&]() { 102 arg += 1; 103 }(); 104 } 105 106 return A+arg; 107 } 108 }; 109 110 int explicit_maps_with_inner_lambda(int a){ 111 CC<123,int> c; 112 return c.foo(a); 113 } 114 115 // CK25: define {{.+}}[[CALL00]]([[ST]]* noundef [[VAL:%.+]]) 116 // CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]], 117 // CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]], 118 // CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0 119 // CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]], 120 // CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* {{[^,]*}} [[CA]]) 121 122 // CK25: define {{.+}}[[LAMBDA]] 123 124 // CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]]) 125 // CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]], 126 // CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]], 127 // CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0 128 // CK25: store i32* [[VAL1]], i32** [[VALADDR1]], 129 // CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* {{[^,]*}} [[CA]]) 130 131 // CK25: define {{.+}}[[LAMBDA2]] 132 #endif // CK25 133 #endif 134