[flang-commits] [flang] [flang][openacc][openmp] Update stride computation for bounds (PR #72168)

Razvan Lupusoru via flang-commits flang-commits at lists.llvm.org
Tue Nov 14 12:28:27 PST 2023


================
@@ -102,4 +102,26 @@ subroutine acc_undefined_extent(a)
 ! HLFIR: %[[PRESENT:.*]] = acc.present varPtr(%[[DECL_ARG0]]#1 : !fir.ref<!fir.array<?xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<?xf32>> {name = "a"}
 ! CHECK: acc.kernels dataOperands(%[[PRESENT]] : !fir.ref<!fir.array<?xf32>>)
 
+  subroutine acc_multi_strides(a)
+    real, dimension(:,:,:) :: a
+
+    !$acc kernels present(a)
+    !$acc end kernels
+  end subroutine
+
+! CHECK-LABEL: func.func @_QMopenacc_boundsPacc_multi_strides(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?x?x?xf32>> {fir.bindc_name = "a"})
+! HLFIR: %[[DECL_ARG0:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QMopenacc_boundsFacc_multi_stridesEa"} : (!fir.box<!fir.array<?x?x?xf32>>) -> (!fir.box<!fir.array<?x?x?xf32>>, !fir.box<!fir.array<?x?x?xf32>>)
+! HLFIR: %[[BOX_DIMS0:.*]]:3 = fir.box_dims %[[DECL_ARG0]]#1, %c0{{.*}} : (!fir.box<!fir.array<?x?x?xf32>>, index) -> (index, index, index)
+! HLFIR: %[[BOUNDS0:.*]] = acc.bounds lowerbound(%{{.*}} : index) upperbound(%{{.*}} : index) stride(%[[BOX_DIMS0]]#2 : index) startIdx(%{{.*}} : index) {strideInBytes = true}
+! HLFIR: %[[STRIDE1:.*]] = arith.muli %27#2, %27#1 : index
----------------
razvanlupusoru wrote:

Should not use %27

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


More information about the flang-commits mailing list