[flang-commits] [flang] [Flang][OpenMP][OpenACC] Handle atomic read/capture when lhs and rhs … (PR #93776)

via flang-commits flang-commits at lists.llvm.org
Fri May 31 09:36:37 PDT 2024


================
@@ -89,3 +89,40 @@ subroutine atomic_read_pointer()
   x = y
 end
 
+! CHECK-LABEL:   func.func @_QPread_with_convert() {
+! CHECK:           %[[VAL_0:.*]] = fir.alloca f32 {bindc_name = "a", uniq_name = "_QFread_with_convertEa"}
+! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFread_with_convertEa"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
+! CHECK:           %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "b", uniq_name = "_QFread_with_convertEb"}
+! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFread_with_convertEb"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK:           %[[VAL_4:.*]] = fir.alloca i32
+! CHECK:           %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {uniq_name = ".atomic.read.temp"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
----------------
harishch4 wrote:

Since I'm handling type converstion at OpenMP Op generation([genOmpAccAtomicCaptureStatement](https://github.com/llvm/llvm-project/blob/98d5d3448d9ddc6fb07855eb45a08652bd530c01/flang/lib/Lower/DirectivesCommon.h#L141)), I need this temporary. To avoid temporary, we can delay handling it till llvm Ir generation(in [OpenMPIRBuilder::createAtomicRead](https://github.com/llvm/llvm-project/blob/98d5d3448d9ddc6fb07855eb45a08652bd530c01/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L5883C17-L5883C34) and [OpenMPIRBuilder::createAtomicCapture](https://github.com/llvm/llvm-project/blob/7b6a89f346f281e5b7caa593a8c484eaf4264055/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L6112)). However I've question [here](https://github.com/llvm/llvm-project/blob/98d5d3448d9ddc6fb07855eb45a08652bd530c01/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L5904). Why do perform atomic op as integer?

https://github.com/llvm/llvm-project/pull/93776


More information about the flang-commits mailing list