1 // Test host codegen. 2 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s 3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s 4 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s 5 6 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s 8 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 9 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}} 10 11 // expected-no-diagnostics 12 #ifndef HEADER 13 #define HEADER 14 15 void foo(int n) { 16 17 // CHECK: [[N:%.+]] = load i32, i32* [[N_ADDR:%.+]], 18 // CHECK: store i32 [[N]], i32* [[DEVICE_CAP:%.+]], 19 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], 20 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 21 // CHECK: [[RET:%.+]] = call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i64* null, i64* null, i8** null, i8** null) 22 // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 23 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] 24 // CHECK: [[FAIL]] 25 // CHECK: call void [[HVT0:@.+]]() 26 // CHECK-NEXT: br label %[[END]] 27 // CHECK: [[END]] 28 #pragma omp target device(n) 29 ; 30 // CHECK: [[N:%.+]] = load i32, i32* [[N_ADDR]], 31 // CHECK: store i32 [[N]], i32* [[DEVICE_CAP:%.+]], 32 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], 33 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 34 // CHECK: [[RET:%.+]] = call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i64* null, i64* null, i8** null, i8** null) 35 // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 36 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] 37 // CHECK: [[FAIL]] 38 // CHECK: call void [[HVT0:@.+]]() 39 // CHECK-NEXT: br label %[[END]] 40 // CHECK: [[END]] 41 #pragma omp target device(device_num: n) 42 ; 43 // CHECK-NOT: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, 44 // CHECK: call void @__omp_offloading_{{.+}}_l46() 45 // CHECK-NOT: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, 46 #pragma omp target device(ancestor: n) 47 ; 48 } 49 50 #endif 51