From cc9f1769e5dcc9891598e352405e04b1a0fe7817 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?utf8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?utf8?q?=E3=83=B3=29?= Date: Tue, 14 Nov 2023 13:17:20 -0800 Subject: [PATCH] [flang][openacc][NFC] Get rid of use-desc-for-alloc=false option in atomic tests (#72291) This option change the default lowering and should not be used. Make the atomic tests more homogenous to the rest of the OpenACC tests. No OpenACC tests use this option. --- flang/test/Lower/OpenACC/acc-atomic-read.f90 | 27 +++++++-------------- flang/test/Lower/OpenACC/acc-atomic-update.f90 | 33 ++++++++++---------------- flang/test/Lower/OpenACC/acc-atomic-write.f90 | 23 ++++++++---------- 3 files changed, 32 insertions(+), 51 deletions(-) diff --git a/flang/test/Lower/OpenACC/acc-atomic-read.f90 b/flang/test/Lower/OpenACC/acc-atomic-read.f90 index 46217d86f01f..985029d3b92d 100644 --- a/flang/test/Lower/OpenACC/acc-atomic-read.f90 +++ b/flang/test/Lower/OpenACC/acc-atomic-read.f90 @@ -1,4 +1,4 @@ -! RUN: bbc --use-desc-for-alloc=false -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s ! This test checks the lowering of atomic read @@ -20,23 +20,14 @@ end program acc_atomic_test ! operation, instead of %[[VAL_3]] and %[[VAL_0]]. !CHECK-LABEL: func.func @_QPatomic_read_pointer() { -!CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_read_pointerEx"} -!CHECK: %[[VAL_1:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_read_pointerEx.addr"} -!CHECK: %[[VAL_2:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box> {bindc_name = "y", uniq_name = "_QFatomic_read_pointerEy"} -!CHECK: %[[VAL_4:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_read_pointerEy.addr"} -!CHECK: %[[VAL_5:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_5]] to %[[VAL_4]] : !fir.ref> -!CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_4]] : !fir.ref> -!CHECK: acc.atomic.read %[[VAL_7]] = %[[VAL_6]] : !fir.ptr, i32 -!CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_4]] : !fir.ref> -!CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_8]] : !fir.ptr -!CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: fir.store %[[VAL_9]] to %[[VAL_10]] : !fir.ptr -!CHECK: return -!CHECK: } +! CHECK: %[[X:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_read_pointerEx"} +! CHECK: %[[Y:.*]] = fir.alloca !fir.box> {bindc_name = "y", uniq_name = "_QFatomic_read_pointerEy"} +! CHECK: %[[LOAD_X:.*]] = fir.load %[[X]] : !fir.ref>> +! CHECK: %[[BOX_ADDR_X:.*]] = fir.box_addr %[[LOAD_X]] : (!fir.box>) -> !fir.ptr +! CHECK: %[[LOAD_Y:.*]] = fir.load %[[Y]] : !fir.ref>> +! CHECK: %[[BOX_ADDR_Y:.*]] = fir.box_addr %[[LOAD_Y]] : (!fir.box>) -> !fir.ptr +! CHECK: acc.atomic.read %[[BOX_ADDR_Y]] = %[[BOX_ADDR_X]] : !fir.ptr, i32 +! CHECK: } subroutine atomic_read_pointer() integer, pointer :: x, y diff --git a/flang/test/Lower/OpenACC/acc-atomic-update.f90 b/flang/test/Lower/OpenACC/acc-atomic-update.f90 index 1bca04320b7e..f9c9e80652ad 100644 --- a/flang/test/Lower/OpenACC/acc-atomic-update.f90 +++ b/flang/test/Lower/OpenACC/acc-atomic-update.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of atomic and atomic update constructs -! RUN: bbc --use-desc-for-alloc=false -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s -! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenacc %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s +! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenacc %s -o - | FileCheck %s program acc_atomic_update_test integer :: x, y, z @@ -11,33 +11,25 @@ program acc_atomic_update_test a=>c b=>d -!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "acc_atomic_update_test"} { !CHECK: %[[A:.*]] = fir.alloca !fir.box> {bindc_name = "a", uniq_name = "_QFEa"} -!CHECK: %[[A_ADDR:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFEa.addr"} -!CHECK: %{{.*}} = fir.zero_bits !fir.ptr -!CHECK: fir.store %{{.*}} to %[[A_ADDR]] : !fir.ref> !CHECK: %[[B:.*]] = fir.alloca !fir.box> {bindc_name = "b", uniq_name = "_QFEb"} -!CHECK: %[[B_ADDR:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFEb.addr"} -!CHECK: %{{.*}} = fir.zero_bits !fir.ptr -!CHECK: fir.store %{{.*}} to %[[B_ADDR]] : !fir.ref> !CHECK: %[[C_ADDR:.*]] = fir.address_of(@_QFEc) : !fir.ref !CHECK: %[[D_ADDR:.*]] = fir.address_of(@_QFEd) : !fir.ref !CHECK: %[[I1:.*]] = fir.alloca i8 {bindc_name = "i1", uniq_name = "_QFEi1"} !CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"} !CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"} !CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFEz"} -!CHECK: %{{.*}} = fir.convert %[[C_ADDR]] : (!fir.ref) -> !fir.ptr -!CHECK: fir.store %{{.*}} to %[[A_ADDR]] : !fir.ref> -!CHECK: %{{.*}} = fir.convert %[[D_ADDR]] : (!fir.ref) -> !fir.ptr -!CHECK: fir.store {{.*}} to %[[B_ADDR]] : !fir.ref> -!CHECK: %[[LOADED_A:.*]] = fir.load %[[A_ADDR]] : !fir.ref> -!CHECK: %[[LOADED_B:.*]] = fir.load %[[B_ADDR]] : !fir.ref> -!CHECK: %{{.*}} = fir.load %[[LOADED_B]] : !fir.ptr -!CHECK: acc.atomic.update %[[LOADED_A]] : !fir.ptr { -!CHECK: ^bb0(%[[ARG:.*]]: i32): -!CHECK: %[[RESULT:.*]] = arith.addi %[[ARG]], %{{.*}} : i32 -!CHECK: acc.yield %[[RESULT]] : i32 +!CHECK: %[[LOAD_A:.*]] = fir.load %[[A]] : !fir.ref>> +!CHECK: %[[BOX_ADDR_A:.*]] = fir.box_addr %[[LOAD_A]] : (!fir.box>) -> !fir.ptr +!CHECK: %[[LOAD_B:.*]] = fir.load %[[B]] : !fir.ref>> +!CHECK: %[[BOX_ADDR_B:.*]] = fir.box_addr %[[LOAD_B]] : (!fir.box>) -> !fir.ptr +!CHECK: %[[LOAD_BOX_ADDR_B:.*]] = fir.load %[[BOX_ADDR_B]] : !fir.ptr +!CHECK: acc.atomic.update %[[BOX_ADDR_A]] : !fir.ptr { +!CHECK: ^bb0(%[[ARG0:.*]]: i32): +!CHECK: %[[ADD:.*]] = arith.addi %[[ARG0]], %[[LOAD_BOX_ADDR_B]] : i32 +!CHECK: acc.yield %[[ADD]] : i32 !CHECK: } + !$acc atomic update a = a + b @@ -72,3 +64,4 @@ program acc_atomic_update_test !CHECK: return !CHECK: } end program acc_atomic_update_test + diff --git a/flang/test/Lower/OpenACC/acc-atomic-write.f90 b/flang/test/Lower/OpenACC/acc-atomic-write.f90 index 5c79db4534d4..7ec6f4e625c1 100644 --- a/flang/test/Lower/OpenACC/acc-atomic-write.f90 +++ b/flang/test/Lower/OpenACC/acc-atomic-write.f90 @@ -1,4 +1,4 @@ -! RUN: bbc --use-desc-for-alloc=false -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s +! RUN: bbc -fopenacc -emit-fir -hlfir=false %s -o - | FileCheck %s ! This test checks the lowering of atomic write @@ -23,18 +23,15 @@ end program acc_atomic_write_test ! Test lowering atomic read for pointer variables. !CHECK-LABEL: func.func @_QPatomic_write_pointer() { -!CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_write_pointerEx"} -!CHECK: %[[VAL_1:.*]] = fir.alloca !fir.ptr {uniq_name = "_QFatomic_write_pointerEx.addr"} -!CHECK: %[[VAL_2:.*]] = fir.zero_bits !fir.ptr -!CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref> -!CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 -!CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: acc.atomic.write %[[VAL_4]] = %[[VAL_3]] : !fir.ptr, i32 -!CHECK: %[[VAL_5:.*]] = arith.constant 2 : i32 -!CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_1]] : !fir.ref> -!CHECK: fir.store %[[VAL_5]] to %[[VAL_6]] : !fir.ptr -!CHECK: return -!CHECK: } +!CHECK: %[[X:.*]] = fir.alloca !fir.box> {bindc_name = "x", uniq_name = "_QFatomic_write_pointerEx"} +!CHECK: %[[C1:.*]] = arith.constant 1 : i32 +!CHECK: %[[LOAD_X:.*]] = fir.load %[[X]] : !fir.ref>> +!CHECK: %[[BOX_ADDR_X:.*]] = fir.box_addr %[[LOAD_X]] : (!fir.box>) -> !fir.ptr +!CHECK: acc.atomic.write %[[BOX_ADDR_X]] = %[[C1]] : !fir.ptr, i32 +!CHECK: %[[C2:.*]] = arith.constant 2 : i32 +!CHECK: %[[LOAD_X:.*]] = fir.load %[[X]] : !fir.ref>> +!CHECK: %[[BOX_ADDR_X:.*]] = fir.box_addr %[[LOAD_X]] : (!fir.box>) -> !fir.ptr +!CHECK: fir.store %[[C2]] to %[[BOX_ADDR_X]] : !fir.ptr subroutine atomic_write_pointer() integer, pointer :: x -- 2.11.4.GIT