[DAG] TransformFPLoadStorePair - early out if we're not loading a simple type
[llvm-project.git] / clang / test / OpenMP / target_data_use_device_ptr_if_codegen.cpp
blob5da5806752ceed3a71bc4bfe78852d4491780833
1 // expected-no-diagnostics
2 #ifndef HEADER
3 #define HEADER
4 ///==========================================================================///
5 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
6 // RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
8 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
9 // RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
12 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s
13 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
14 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
15 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s
16 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
17 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
18 // SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
19 #ifdef CK1
21 // CK1: [[MTYPE00:@.+]] = {{.*}}constant [1 x i64] [i64 67]
22 // CK1: [[MTYPE01:@.+]] = {{.*}}constant [1 x i64] [i64 288]
23 // CK1: [[MTYPE02:@.+]] = {{.*}}constant [1 x i64] [i64 288]
25 void add_one(float *b, int dm)
27 // CK1: [[BP:%.+]] = getelementptr inbounds [1 x ptr], ptr %{{.+}}, i32 0, i32 0
28 // CK1: store ptr [[B_ADDR:%.+]], ptr [[BP]]
29 // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE00]]
30 // CK1: [[VAL:%.+]] = load ptr, ptr [[BP]],
31 // CK1-NOT: store ptr [[VAL]], ptr {{%.+}},
32 // CK1: store ptr [[VAL]], ptr [[PVT:%.+]],
33 // CK1: [[TT:%.+]] = load ptr, ptr [[PVT]],
34 // CK1: call i32 @__tgt_target{{.+}}
35 // CK1: call i32 @__tgt_target{{.+}}
36 // CK1: call void @__tgt_target_data_end{{.+}}[[MTYPE00]]
37 #pragma omp target data map(tofrom:b[:1]) use_device_ptr(b) if(dm == 0)
39 #pragma omp target is_device_ptr(b)
41 b[0] += 1;
46 #endif
47 #endif