Debian Codegraph @

clang/test/OpenMP/target_map_codegen_33.cpp

raw
1 // expected-no-diagnostics
2 #ifndef HEADER
3 #define HEADER
4
5 ///==========================================================================///
6 // RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-64
7 // RUN: %clang_cc1 -DCK32 -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 -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 CK32 --check-prefix CK32-64
9 // RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-32
10 // RUN: %clang_cc1 -DCK32 -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 -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 CK32 --check-prefix CK32-32
12
13 // RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s
14 // RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
15 // 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-ONLY32 %s
16 // RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s
17 // RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
18 // 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-ONLY32 %s
19 // SIMD-ONLY32-NOT: {{__kmpc|__tgt}}
20 #ifdef CK32
21
22 // CK32-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [2 x i64] [i64 33, i64 16384]
23 // CK32-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [2 x i64] [i64 34, i64 16384]
24
25 void array_shaping(float *f, int sa) {
26
27 // Region 01
28 // &f[0], &f[0], <size-of-shaping-array>, PARAM | TO
29 // &f, &f[0], sizeof(f), ATTACH
30 //
31 // CK32-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
32 // CK32-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
33 // CK32-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
34 // CK32-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
35 // CK32-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
36 // CK32-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
37 // CK32-DAG: store ptr [[SIZES:%.+]], ptr [[SARG]]
38 // CK32-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
39 // CK32-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
40 // CK32-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
41
42 // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
43 // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
44 // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
45
46 // CK32-DAG: store ptr [[F1:%.+]], ptr [[BP0]],
47 // CK32-DAG: store ptr [[F2:%.+]], ptr [[P0]],
48 // CK32-DAG: store i64 [[SIZE:%.+]], ptr [[S0]],
49
50 // CK32-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
51 // CK32-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
52
53 // CK32-DAG: store ptr [[F_ADDR:%.+]], ptr [[BP1]],
54 // CK32-DAG: store ptr [[F2]], ptr [[P1]],
55
56 // CK32-DAG: [[F1]] = load ptr, ptr [[F_ADDR]],
57 // CK32-DAG: [[F2]] = load ptr, ptr [[F_ADDR]],
58 // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 4
59 // CK32-64-DAG: [[SZ1]] = mul nuw i64 12, %{{.+}}
60 // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64
61 // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 4
62 // CK32-32-DAG: [[SZ2]] = mul nuw i32 12, %{{.+}}
63 #pragma omp target map(to \
64 : ([3][sa][4])f)
65 f[0] = 1;
66 sa = 1;
67
68 // Region 02
69 // &f[0], &f[0], <size-of-shaping-array>, PARAM | FROM
70 // &f, &f[0], sizeof(f), ATTACH
71 //
72 // CK32-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
73 // CK32-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
74 // CK32-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
75 // CK32-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
76 // CK32-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
77 // CK32-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
78 // CK32-DAG: store ptr [[SIZES:%.+]], ptr [[SARG]]
79 // CK32-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
80 // CK32-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
81 // CK32-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
82
83 // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
84 // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
85 // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
86
87 // CK32-DAG: store ptr [[F1:%.+]], ptr [[BP0]],
88 // CK32-DAG: store ptr [[F2:%.+]], ptr [[P0]],
89 // CK32-DAG: store i64 [[SIZE:%.+]], ptr [[S0]],
90
91 // CK32-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
92 // CK32-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
93
94 // CK32-DAG: store ptr [[F_ADDR:%.+]], ptr [[BP1]],
95 // CK32-DAG: store ptr [[F2]], ptr [[P1]],
96
97 // CK32-DAG: [[F1]] = load ptr, ptr [[F_ADDR]],
98 // CK32-DAG: [[F2]] = load ptr, ptr [[F_ADDR]],
99 // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 5
100 // CK32-64-DAG: [[SZ1]] = mul nuw i64 4, %{{.+}}
101 // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64
102 // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 5
103 // CK32-32-DAG: [[SZ2]] = mul nuw i32 4, %{{.+}}
104 #pragma omp target map(from \
105 : ([sa][5])f)
106 f[0] = 1;
107 }
108
109 #endif // CK32
110 #endif