brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.5 KiB · 5e00235 Raw
133 lines · plain
1! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s2 3! CHECK: func.func @_QPatomic_implicit_cast_read() {4subroutine atomic_implicit_cast_read5! CHECK: %[[ALLOCA7:.*]] = fir.alloca complex<f64>6! CHECK: %[[ALLOCA6:.*]] = fir.alloca i327! CHECK: %[[ALLOCA5:.*]] = fir.alloca i328! CHECK: %[[ALLOCA4:.*]] = fir.alloca i329! CHECK: %[[ALLOCA3:.*]] = fir.alloca complex<f32>10! CHECK: %[[ALLOCA2:.*]] = fir.alloca complex<f32>11! CHECK: %[[ALLOCA1:.*]] = fir.alloca i3212! CHECK: %[[ALLOCA0:.*]] = fir.alloca f3213 14! CHECK: %[[M:.*]] = fir.alloca complex<f64> {bindc_name = "m", uniq_name = "_QFatomic_implicit_cast_readEm"}15! CHECK: %[[M_DECL:.*]]:2 = hlfir.declare %[[M]] {uniq_name = "_QFatomic_implicit_cast_readEm"} : (!fir.ref<complex<f64>>) -> (!fir.ref<complex<f64>>, !fir.ref<complex<f64>>)16! CHECK: %[[W:.*]] = fir.alloca complex<f32> {bindc_name = "w", uniq_name = "_QFatomic_implicit_cast_readEw"}17! CHECK: %[[W_DECL:.*]]:2 = hlfir.declare %[[W]] {uniq_name = "_QFatomic_implicit_cast_readEw"} : (!fir.ref<complex<f32>>) -> (!fir.ref<complex<f32>>, !fir.ref<complex<f32>>)18! CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFatomic_implicit_cast_readEx"}19! CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {uniq_name = "_QFatomic_implicit_cast_readEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)20! CHECK: %[[Y:.*]] = fir.alloca f32 {bindc_name = "y", uniq_name = "_QFatomic_implicit_cast_readEy"}21! CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y]] {uniq_name = "_QFatomic_implicit_cast_readEy"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)22! CHECK: %[[Z:.*]] = fir.alloca f64 {bindc_name = "z", uniq_name = "_QFatomic_implicit_cast_readEz"}23! CHECK: %[[Z_DECL:.*]]:2 = hlfir.declare %[[Z]] {uniq_name = "_QFatomic_implicit_cast_readEz"} : (!fir.ref<f64>) -> (!fir.ref<f64>, !fir.ref<f64>)24    integer :: x25    real :: y26    double precision :: z27    complex :: w28    complex(8) :: m29 30! CHECK: omp.atomic.read %[[ALLOCA0:.*]] = %[[Y_DECL]]#0 : !fir.ref<f32>, !fir.ref<f32>, f3231! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA0]] : !fir.ref<f32>32! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (f32) -> i3233! CHECK: fir.store %[[CVT]] to %[[X_DECL]]#0 : !fir.ref<i32>34    !$omp atomic read35        x = y36 37! CHECK: omp.atomic.read %[[ALLOCA1:.*]] = %[[X_DECL]]#0 : !fir.ref<i32>, !fir.ref<i32>, i3238! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA1]] : !fir.ref<i32>39! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (i32) -> f6440! CHECK: fir.store %[[CVT]] to %[[Z_DECL]]#0 : !fir.ref<f64>41    !$omp atomic read42        z = x43 44! CHECK: omp.atomic.read %[[ALLOCA2:.*]] = %[[W_DECL]]#0 : !fir.ref<complex<f32>>, !fir.ref<complex<f32>>, complex<f32>45! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA2]] : !fir.ref<complex<f32>>46! CHECK: %[[EXTRACT:.*]] = fir.extract_value %[[LOAD]], [0 : index] : (complex<f32>) -> f3247! CHECK: %[[CVT:.*]] = fir.convert %[[EXTRACT]] : (f32) -> i3248! CHECK: fir.store %[[CVT]] to %[[X_DECL]]#0 : !fir.ref<i32>49    !$omp atomic read50        x = w51 52! CHECK: omp.atomic.read %[[ALLOCA3:.*]] = %[[W_DECL]]#0 : !fir.ref<complex<f32>>, !fir.ref<complex<f32>>, complex<f32>53! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA3]] : !fir.ref<complex<f32>>54! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (complex<f32>) -> complex<f64>55! CHECK: fir.store %[[CVT]] to %[[M_DECL]]#0 : !fir.ref<complex<f64>>56    !$omp atomic read57        m = w58 59! CHECK: %[[CONST:.*]] = arith.constant 1 : i3260! CHECK: omp.atomic.capture {61! CHECK: omp.atomic.read %[[ALLOCA4]] = %[[X_DECL]]#0 : !fir.ref<i32>, !fir.ref<i32>, i3262! CHECK: omp.atomic.update %[[X_DECL]]#0 : !fir.ref<i32> {63! CHECK: ^bb0(%[[ARG:.*]]: i32):64! CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], %[[CONST]] : i3265! CHECK: omp.yield(%[[RESULT]] : i32)66! CHECK: }67! CHECK: }68! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA4]] : !fir.ref<i32>69! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (i32) -> f3270! CHECK: fir.store %[[CVT]] to %[[Y_DECL]]#0 : !fir.ref<f32>71     !$omp atomic capture72        y = x73        x = x + 174     !$omp end atomic75 76! CHECK: %[[CONST:.*]] = arith.constant 10 : i3277! CHECK: omp.atomic.capture {78! CHECK: omp.atomic.read %[[ALLOCA5:.*]] = %[[X_DECL]]#0 : !fir.ref<i32>, !fir.ref<i32>, i3279! CHECK: omp.atomic.write %[[X_DECL]]#0 = %[[CONST]] : !fir.ref<i32>, i3280! CHECK: }81! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA5]] : !fir.ref<i32>82! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (i32) -> f6483! CHECK: fir.store %[[CVT]] to %[[Z_DECL]]#0 : !fir.ref<f64>84     !$omp atomic capture85        z = x86        x = 1087     !$omp end atomic88 89! CHECK: %[[CONST:.*]] = arith.constant 1 : i3290! CHECK: omp.atomic.capture {91! CHECK: omp.atomic.update %[[X_DECL]]#0 : !fir.ref<i32> {92! CHECK: ^bb0(%[[ARG:.*]]: i32):93! CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], %[[CONST]] : i3294! CHECK: omp.yield(%[[RESULT]] : i32)95! CHECK: }96! CHECK: omp.atomic.read %[[ALLOCA6]] = %[[X_DECL]]#0 : !fir.ref<i32>, !fir.ref<i32>, i3297! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA6]] : !fir.ref<i32>98! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (i32) -> f3299! CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32100! CHECK: %[[UNDEF:.*]] = fir.undefined complex<f32>101! CHECK: %[[IDX1:.*]] = fir.insert_value %[[UNDEF]], %[[CVT]], [0 : index] : (complex<f32>, f32) -> complex<f32>102! CHECK: %[[IDX2:.*]] = fir.insert_value %[[IDX1]], %[[CST]], [1 : index] : (complex<f32>, f32) -> complex<f32>103! CHECK: fir.store %[[IDX2]] to %[[W_DECL]]#0 : !fir.ref<complex<f32>>104     !$omp atomic capture105        x = x + 1106        w = x107     !$omp end atomic108 109 110! CHECK: %[[CST1:.*]] = arith.constant 1.000000e+00 : f64111! CHECK: %[[CST2:.*]] = arith.constant 0.000000e+00 : f64112! CHECK: %[[UNDEF:.*]] = fir.undefined complex<f64>113! CHECK: %[[IDX1:.*]] = fir.insert_value %[[UNDEF]], %[[CST1]], [0 : index] : (complex<f64>, f64) -> complex<f64>114! CHECK: %[[IDX2:.*]] = fir.insert_value %[[IDX1]], %[[CST2]], [1 : index] : (complex<f64>, f64) -> complex<f64>115! CHECK: omp.atomic.capture {116! CHECK: omp.atomic.update %[[M_DECL]]#0 : !fir.ref<complex<f64>> {117! CHECK: ^bb0(%[[ARG:.*]]: complex<f64>):118! CHECK: %[[RESULT:.*]] = fir.addc %[[ARG]], %[[IDX2]] {fastmath = #arith.fastmath<contract>} : complex<f64>119! CHECK: omp.yield(%[[RESULT]] : complex<f64>)120! CHECK: }121! CHECK: omp.atomic.read %[[ALLOCA7]] = %[[M_DECL]]#0 : !fir.ref<complex<f64>>, !fir.ref<complex<f64>>, complex<f64>122! CHECK: }123! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA7]] : !fir.ref<complex<f64>>124! CHECK: %[[CVT:.*]] = fir.convert %[[LOAD]] : (complex<f64>) -> complex<f32>125! CHECK: fir.store %[[CVT]] to %[[W_DECL]]#0 : !fir.ref<complex<f32>>126     !$omp atomic capture127        m = m + 1128        w = m129     !$omp end atomic130 131 132end subroutine133