[flang][openacc][NFC] Get rid of use-desc-for-alloc=false option in atomic tests...
[llvm-project.git] / flang / test / Lower / OpenACC / acc-atomic-read.f90
blob985029d3b92d18760a1a89ee301eeacaeb9a9257
1 ! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s
3 ! This test checks the lowering of atomic read
5 !CHECK: func @_QQmain() attributes {fir.bindc_name = "acc_atomic_test"} {
6 !CHECK: %[[VAR_G:.*]] = fir.alloca f32 {bindc_name = "g", uniq_name = "_QFEg"}
7 !CHECK: %[[VAR_H:.*]] = fir.alloca f32 {bindc_name = "h", uniq_name = "_QFEh"}
8 !CHECK: acc.atomic.read %[[VAR_G]] = %[[VAR_H]] : !fir.ref<f32>, f32
9 !CHECK: return
10 !CHECK: }
12 program acc_atomic_test
13 real g, h
14 !$acc atomic read
15 g = h
16 end program acc_atomic_test
18 ! Test lowering atomic read for pointer variables.
19 ! Please notice to use %[[VAL_4]] and %[[VAL_1]] for operands of atomic
20 ! operation, instead of %[[VAL_3]] and %[[VAL_0]].
22 !CHECK-LABEL: func.func @_QPatomic_read_pointer() {
23 ! CHECK: %[[X:.*]] = fir.alloca !fir.box<!fir.ptr<i32>> {bindc_name = "x", uniq_name = "_QFatomic_read_pointerEx"}
24 ! CHECK: %[[Y:.*]] = fir.alloca !fir.box<!fir.ptr<i32>> {bindc_name = "y", uniq_name = "_QFatomic_read_pointerEy"}
25 ! CHECK: %[[LOAD_X:.*]] = fir.load %[[X]] : !fir.ref<!fir.box<!fir.ptr<i32>>>
26 ! CHECK: %[[BOX_ADDR_X:.*]] = fir.box_addr %[[LOAD_X]] : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>
27 ! CHECK: %[[LOAD_Y:.*]] = fir.load %[[Y]] : !fir.ref<!fir.box<!fir.ptr<i32>>>
28 ! CHECK: %[[BOX_ADDR_Y:.*]] = fir.box_addr %[[LOAD_Y]] : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>
29 ! CHECK: acc.atomic.read %[[BOX_ADDR_Y]] = %[[BOX_ADDR_X]] : !fir.ptr<i32>, i32
30 ! CHECK: }
32 subroutine atomic_read_pointer()
33 integer, pointer :: x, y
35 !$acc atomic read
36 y = x
38 x = y
39 end
41 subroutine atomic_read_with_convert()
42 integer(4) :: x
43 integer(8) :: y
45 !$acc atomic read
46 y = x
47 end
49 ! CHECK-LABEL: func.func @_QPatomic_read_with_convert() {
50 ! CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFatomic_read_with_convertEx"}
51 ! CHECK: %[[Y:.*]] = fir.alloca i64 {bindc_name = "y", uniq_name = "_QFatomic_read_with_convertEy"}
52 ! CHECK: %[[CONV:.*]] = fir.convert %[[X]] : (!fir.ref<i32>) -> !fir.ref<i64>
53 ! CHECK: acc.atomic.read %[[Y]] = %[[CONV]] : !fir.ref<i64>, i32