CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
62 lines
3.4 KiB
Fortran
62 lines
3.4 KiB
Fortran
! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
|
|
|
|
! CHECK-LABEL: func @_QPubound_test(
|
|
subroutine ubound_test(a, dim, res)
|
|
real, dimension(:, :) :: a
|
|
integer(8):: dim, res
|
|
! CHECK-DAG: %[[aDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_testEa"}
|
|
! CHECK-DAG: %[[dimDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_testEdim"}
|
|
! CHECK-DAG: %[[resDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_testEres"}
|
|
! CHECK: %[[dimVal:.*]] = fir.load %[[dimDecl]]#0 : !fir.ref<i64>
|
|
! CHECK: %[[size:.*]] = fir.call @_FortranASizeDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lbound:.*]] = fir.call @_FortranALboundDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lb_m1:.*]] = arith.subi %[[lbound]], {{.*}} : i64
|
|
! CHECK: %[[ub:.*]] = arith.addi %[[lb_m1]], %[[size]] : i64
|
|
! CHECK: hlfir.assign %[[ub]] to %[[resDecl]]#0 : i64, !fir.ref<i64>
|
|
res = ubound(a, dim, 8)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPubound_test_2(
|
|
subroutine ubound_test_2(a, dim, res)
|
|
real, dimension(2:, 3:) :: a
|
|
integer(8):: dim, res
|
|
! CHECK-DAG: %[[aDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_test_2Ea"}
|
|
! CHECK-DAG: %[[dimDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_test_2Edim"}
|
|
! CHECK-DAG: %[[resDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_test_2Eres"}
|
|
! CHECK: %[[size:.*]] = fir.call @_FortranASizeDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lbound:.*]] = fir.call @_FortranALboundDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lb_m1:.*]] = arith.subi %[[lbound]], {{.*}} : i64
|
|
! CHECK: %[[ub:.*]] = arith.addi %[[lb_m1]], %[[size]] : i64
|
|
! CHECK: hlfir.assign %[[ub]] to %[[resDecl]]#0 : i64, !fir.ref<i64>
|
|
res = ubound(a, dim, 8)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPubound_test_3(
|
|
subroutine ubound_test_3(a, dim, res)
|
|
real, dimension(10, 20, *) :: a
|
|
integer(8):: dim, res
|
|
! CHECK: %[[assumed:.*]] = fir.assumed_size_extent : index
|
|
! CHECK: %[[shape:.*]] = fir.shape %{{.*}}, %{{.*}}, %[[assumed]] : (index, index, index) -> !fir.shape<3>
|
|
! CHECK: %[[aDecl:.*]]:2 = hlfir.declare {{.*}}(%[[shape]]) {{.*}}{uniq_name = "_QFubound_test_3Ea"}
|
|
! CHECK: %[[embox:.*]] = fir.embox %[[aDecl]]#1(%{{.*}}) : (!fir.ref<!fir.array<10x20x?xf32>>, !fir.shape<3>) -> !fir.box<!fir.array<10x20x?xf32>>
|
|
! CHECK: %[[size:.*]] = fir.call @_FortranASizeDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lbound:.*]] = fir.call @_FortranALboundDim({{.*}}) {{.*}}: (!fir.box<none>, i32, !fir.ref<i8>, i32) -> i64
|
|
! CHECK: %[[lb_m1:.*]] = arith.subi %[[lbound]], {{.*}} : i64
|
|
! CHECK: %[[ub:.*]] = arith.addi %[[lb_m1]], %[[size]] : i64
|
|
! CHECK: hlfir.assign %[[ub]] to {{.*}} : i64, !fir.ref<i64>
|
|
res = ubound(a, dim, 8)
|
|
end subroutine
|
|
|
|
|
|
! CHECK-LABEL: func @_QPubound_test_const_dim(
|
|
subroutine ubound_test_const_dim(array)
|
|
real :: array(11:)
|
|
integer :: res
|
|
! Should not call _FortranASizeDim when dim is compile time constant. But instead load from descriptor directly.
|
|
! CHECK: %[[arrayDecl:.*]]:2 = hlfir.declare {{.*}}{uniq_name = "_QFubound_test_const_dimEarray"}
|
|
! CHECK: %[[C0:.*]] = arith.constant 0 : index
|
|
! CHECK: %[[DIMS:.*]]:3 = fir.box_dims %[[arrayDecl]]#1, %[[C0]] : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
|
|
! CHECK: %{{.*}} = fir.convert %[[DIMS]]#1 : (index) -> i32
|
|
res = ubound(array, 1)
|
|
end subroutine
|