[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / flang / test / Lower / OpenMP / threadprivate-integer-different-kinds.f90
blob660202221e3f87cb727867de0ade2f736162d9e6
1 ! This test checks lowering of OpenMP Threadprivate Directive.
2 ! Test for variables with different kind.
4 !REQUIRES: shell
5 !RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
7 program test
8 integer, save :: i
9 integer(kind=1), save :: i1
10 integer(kind=2), save :: i2
11 integer(kind=4), save :: i4
12 integer(kind=8), save :: i8
13 integer(kind=16), save :: i16
15 !CHECK-DAG: %[[I:.*]] = fir.address_of(@_QFEi) : !fir.ref<i32>
16 !CHECK-DAG: %[[I_DECL:.*]]:2 = hlfir.declare %[[I]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
17 !CHECK-DAG: %[[OMP_I:.*]] = omp.threadprivate %[[I_DECL]]#1 : !fir.ref<i32> -> !fir.ref<i32>
18 !CHECK-DAG: %[[OMP_I_DECL:.*]]:2 = hlfir.declare %[[OMP_I]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
19 !CHECK-DAG: %[[I1:.*]] = fir.address_of(@_QFEi1) : !fir.ref<i8>
20 !CHECK-DAG: %[[I1_DECL:.*]]:2 = hlfir.declare %[[I1]] {uniq_name = "_QFEi1"} : (!fir.ref<i8>) -> (!fir.ref<i8>, !fir.ref<i8>)
21 !CHECK-DAG: %[[OMP_I1:.*]] = omp.threadprivate %[[I1_DECL]]#1 : !fir.ref<i8> -> !fir.ref<i8>
22 !CHECK-DAG: %[[OMP_I1_DECL:.*]]:2 = hlfir.declare %[[OMP_I1]] {uniq_name = "_QFEi1"} : (!fir.ref<i8>) -> (!fir.ref<i8>, !fir.ref<i8>)
23 !CHECK-DAG: %[[I16:.*]] = fir.address_of(@_QFEi16) : !fir.ref<i128>
24 !CHECK-DAG: %[[I16_DECL:.*]]:2 = hlfir.declare %[[I16]] {uniq_name = "_QFEi16"} : (!fir.ref<i128>) -> (!fir.ref<i128>, !fir.ref<i128>)
25 !CHECK-DAG: %[[OMP_I16:.*]] = omp.threadprivate %[[I16_DECL]]#1 : !fir.ref<i128> -> !fir.ref<i128>
26 !CHECK-DAG: %[[OMP_I16_DECL:.*]]:2 = hlfir.declare %[[OMP_I16]] {uniq_name = "_QFEi16"} : (!fir.ref<i128>) -> (!fir.ref<i128>, !fir.ref<i128>)
27 !CHECK-DAG: %[[I2:.*]] = fir.address_of(@_QFEi2) : !fir.ref<i16>
28 !CHECK-DAG: %[[I2_DECL:.*]]:2 = hlfir.declare %[[I2]] {uniq_name = "_QFEi2"} : (!fir.ref<i16>) -> (!fir.ref<i16>, !fir.ref<i16>)
29 !CHECK-DAG: %[[OMP_I2:.*]] = omp.threadprivate %[[I2_DECL]]#1 : !fir.ref<i16> -> !fir.ref<i16>
30 !CHECK-DAG: %[[OMP_I2_DECL:.*]]:2 = hlfir.declare %[[OMP_I2]] {uniq_name = "_QFEi2"} : (!fir.ref<i16>) -> (!fir.ref<i16>, !fir.ref<i16>)
31 !CHECK-DAG: %[[I4:.*]] = fir.address_of(@_QFEi4) : !fir.ref<i32>
32 !CHECK-DAG: %[[I4_DECL:.*]]:2 = hlfir.declare %[[I4]] {uniq_name = "_QFEi4"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
33 !CHECK-DAG: %[[OMP_I4:.*]] = omp.threadprivate %[[I4_DECL]]#1 : !fir.ref<i32> -> !fir.ref<i32>
34 !CHECK-DAG: %[[OMP_I4_DECL:.*]]:2 = hlfir.declare %[[OMP_I4]] {uniq_name = "_QFEi4"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
35 !CHECK-DAG: %[[I8:.*]] = fir.address_of(@_QFEi8) : !fir.ref<i64>
36 !CHECK-DAG: %[[I8_DECL:.*]]:2 = hlfir.declare %[[I8]] {uniq_name = "_QFEi8"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
37 !CHECK-DAG: %[[OMP_I8:.*]] = omp.threadprivate %[[I8_DECL]]#1 : !fir.ref<i64> -> !fir.ref<i64>
38 !CHECK-DAG: %[[OMP_I8_DECL:.*]]:2 = hlfir.declare %[[OMP_I8]] {uniq_name = "_QFEi8"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
39 !$omp threadprivate(i, i1, i2, i4, i8, i16)
41 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I_DECL]]#0 : !fir.ref<i32>
42 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I1_DECL]]#0 : !fir.ref<i8>
43 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I16_DECL]]#0 : !fir.ref<i128>
44 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I2_DECL]]#0 : !fir.ref<i16>
45 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I4_DECL]]#0 : !fir.ref<i32>
46 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I8_DECL]]#0 : !fir.ref<i64>
47 print *, i, i1, i2, i4, i8, i16
49 !$omp parallel
50 !CHECK-DAG: %[[I_PVT:.*]] = omp.threadprivate %[[I_DECL]]#1 : !fir.ref<i32> -> !fir.ref<i32>
51 !CHECK-DAG: %[[I_PVT_DECL:.*]]:2 = hlfir.declare %[[I_PVT]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
52 !CHECK-DAG: %[[I1_PVT:.*]] = omp.threadprivate %[[I1_DECL]]#1 : !fir.ref<i8> -> !fir.ref<i8>
53 !CHECK-DAG: %[[I1_PVT_DECL:.*]]:2 = hlfir.declare %[[I1_PVT]] {uniq_name = "_QFEi1"} : (!fir.ref<i8>) -> (!fir.ref<i8>, !fir.ref<i8>)
54 !CHECK-DAG: %[[I2_PVT:.*]] = omp.threadprivate %[[I2_DECL]]#1 : !fir.ref<i16> -> !fir.ref<i16>
55 !CHECK-DAG: %[[I2_PVT_DECL:.*]]:2 = hlfir.declare %[[I2_PVT]] {uniq_name = "_QFEi2"} : (!fir.ref<i16>) -> (!fir.ref<i16>, !fir.ref<i16>)
56 !CHECK-DAG: %[[I4_PVT:.*]] = omp.threadprivate %[[I4_DECL]]#1 : !fir.ref<i32> -> !fir.ref<i32>
57 !CHECK-DAG: %[[I4_PVT_DECL:.*]]:2 = hlfir.declare %[[I4_PVT]] {uniq_name = "_QFEi4"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
58 !CHECK-DAG: %[[I8_PVT:.*]] = omp.threadprivate %[[I8_DECL]]#1 : !fir.ref<i64> -> !fir.ref<i64>
59 !CHECK-DAG: %[[I8_PVT_DECL:.*]]:2 = hlfir.declare %[[I8_PVT]] {uniq_name = "_QFEi8"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
60 !CHECK-DAG: %[[I16_PVT:.*]] = omp.threadprivate %[[I16_DECL]]#1 : !fir.ref<i128> -> !fir.ref<i128>
61 !CHECK-DAG: %[[I16_PVT_DECL:.*]]:2 = hlfir.declare %[[I16_PVT]] {uniq_name = "_QFEi16"} : (!fir.ref<i128>) -> (!fir.ref<i128>, !fir.ref<i128>)
62 !CHECK-DAG: %{{.*}} = fir.load %[[I_PVT_DECL]]#0 : !fir.ref<i32>
63 !CHECK-DAG: %{{.*}} = fir.load %[[I1_PVT_DECL]]#0 : !fir.ref<i8>
64 !CHECK-DAG: %{{.*}} = fir.load %[[I16_PVT_DECL]]#0 : !fir.ref<i128>
65 !CHECK-DAG: %{{.*}} = fir.load %[[I2_PVT_DECL]]#0 : !fir.ref<i16>
66 !CHECK-DAG: %{{.*}} = fir.load %[[I4_PVT_DECL]]#0 : !fir.ref<i32>
67 !CHECK-DAG: %{{.*}} = fir.load %[[I8_PVT_DECL]]#0 : !fir.ref<i64>
68 print *, i, i1, i2, i4, i8, i16
69 !$omp end parallel
71 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I_DECL]]#0 : !fir.ref<i32>
72 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I1_DECL]]#0 : !fir.ref<i8>
73 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I16_DECL]]#0 : !fir.ref<i128>
74 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I2_DECL]]#0 : !fir.ref<i16>
75 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I4_DECL]]#0 : !fir.ref<i32>
76 !CHECK-DAG: %{{.*}} = fir.load %[[OMP_I8_DECL]]#0 : !fir.ref<i64>
77 print *, i, i1, i2, i4, i8, i16
79 !CHECK-DAG: fir.global internal @_QFEi : i32 {
80 !CHECK-DAG: fir.global internal @_QFEi1 : i8 {
81 !CHECK-DAG: fir.global internal @_QFEi16 : i128 {
82 !CHECK-DAG: fir.global internal @_QFEi2 : i16 {
83 !CHECK-DAG: fir.global internal @_QFEi4 : i32 {
84 !CHECK-DAG: fir.global internal @_QFEi8 : i64 {
85 end