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
116 lines
6.8 KiB
Fortran
116 lines
6.8 KiB
Fortran
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
|
|
|
|
! Test assumed shape dummy argument on callee side
|
|
|
|
! TODO: These tests rely on looking at how a new fir.box is made for an assumed shape
|
|
! to see if lowering lowered and mapped the assumed shape symbol properties.
|
|
! However, the argument fir.box of the assumed shape could also be used instead
|
|
! of making a new fir.box and this would break all these tests. In fact, for non
|
|
! contiguous arrays, this is the case. Find a better way to tests symbol lowering/mapping.
|
|
|
|
! CHECK-LABEL: func @_QPtest_assumed_shape_1(%arg0: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "x", fir.contiguous})
|
|
subroutine test_assumed_shape_1(x)
|
|
integer, contiguous :: x(:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0 : (!fir.box<!fir.array<?xi32>>) -> !fir.ref<!fir.array<?xi32>>
|
|
! CHECK: %[[c0:.*]] = arith.constant 0 : index
|
|
! CHECK: %[[dims:.*]]:3 = fir.box_dims %arg0, %[[c0]] : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index)
|
|
! CHECK: %[[c1:.*]] = arith.constant 1 : index
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) dummy_scope %{{.*}} arg 1 {fortran_attrs = #fir.var_attrs<contiguous>, uniq_name = "_QFtest_assumed_shape_1Ex"} : (!fir.ref<!fir.array<?xi32>>, !fir.shapeshift<1>, !fir.dscope) -> (!fir.box<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>)
|
|
|
|
print *, x
|
|
! Test extent/lower bound use in the IO statement
|
|
! CHECK: %[[cookie:.*]] = fir.call @_FortranAioBeginExternalListOutput
|
|
! CHECK: %[[shape:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: %[[newbox:.*]] = fir.embox %[[decl]]#1(%[[shape]]) : (!fir.ref<!fir.array<?xi32>>, !fir.shapeshift<1>) -> !fir.box<!fir.array<?xi32>>
|
|
! CHECK: %[[castedBox:.*]] = fir.convert %[[newbox]] : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>
|
|
! CHECK: fir.call @_FortranAioOutputDescriptor(%[[cookie]], %[[castedBox]]) {{.*}}: (!fir.ref<i8>, !fir.box<none>) -> i1
|
|
end subroutine
|
|
|
|
! lower bounds all ones
|
|
! CHECK-LABEL: func @_QPtest_assumed_shape_2(%arg0: !fir.box<!fir.array<?x?xf32>> {fir.bindc_name = "x", fir.contiguous})
|
|
subroutine test_assumed_shape_2(x)
|
|
real, contiguous :: x(1:, 1:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0
|
|
! CHECK: %[[dims1:.*]]:3 = fir.box_dims %arg0, %c0
|
|
! CHECK: %[[dims2:.*]]:3 = fir.box_dims %arg0, %c1
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape %[[dims1]]#1, %[[dims2]]#1
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) {{.*}}
|
|
print *, x
|
|
! CHECK: fir.call @_FortranAioBeginExternalListOutput
|
|
! CHECK: %[[shape:.*]] = fir.shape %[[dims1]]#1, %[[dims2]]#1
|
|
! CHECK: %[[newbox:.*]] = fir.embox %[[decl]]#1(%[[shape]])
|
|
end subroutine
|
|
|
|
! explicit lower bounds different from 1
|
|
! CHECK-LABEL: func @_QPtest_assumed_shape_3(%arg0: !fir.box<!fir.array<?x?x?xi32>> {fir.bindc_name = "x", fir.contiguous})
|
|
subroutine test_assumed_shape_3(x)
|
|
integer, contiguous :: x(2:, 3:, 42:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0
|
|
! CHECK: %[[dims1:.*]]:3 = fir.box_dims %arg0, %c0
|
|
! CHECK: %[[c2_i64:.*]] = arith.constant 2 : i64
|
|
! CHECK: %[[c2:.*]] = fir.convert %[[c2_i64]] : (i64) -> index
|
|
! CHECK: %[[dims2:.*]]:3 = fir.box_dims %arg0, %c1
|
|
! CHECK: %[[c3_i64:.*]] = arith.constant 3 : i64
|
|
! CHECK: %[[c3:.*]] = fir.convert %[[c3_i64]] : (i64) -> index
|
|
! CHECK: %[[dims3:.*]]:3 = fir.box_dims %arg0, %c2
|
|
! CHECK: %[[c42_i64:.*]] = arith.constant 42 : i64
|
|
! CHECK: %[[c42:.*]] = fir.convert %[[c42_i64]] : (i64) -> index
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape_shift %[[c2]], %[[dims1]]#1, %[[c3]], %[[dims2]]#1, %[[c42]], %[[dims3]]#1
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) {{.*}}
|
|
|
|
print *, x
|
|
! CHECK: %[[shape:.*]] = fir.shape_shift %[[c2]], %{{.*}}, %[[c3]], %{{.*}}, %[[c42]], %{{.*}} :
|
|
! CHECK: fir.embox %[[decl]]#1(%[[shape]])
|
|
end subroutine
|
|
|
|
! Constant length
|
|
! CHECK-LABEL: func @_QPtest_assumed_shape_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,10>>> {fir.bindc_name = "c", fir.contiguous})
|
|
subroutine test_assumed_shape_char(c)
|
|
character(10), contiguous :: c(:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0 : (!fir.box<!fir.array<?x!fir.char<1,10>>>) -> !fir.ref<!fir.array<?x!fir.char<1,10>>>
|
|
|
|
! CHECK: %[[dims:.*]]:3 = fir.box_dims %arg0, %c0 : (!fir.box<!fir.array<?x!fir.char<1,10>>>, index) -> (index, index, index)
|
|
! CHECK: %[[c1:.*]] = arith.constant 1 : index
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) {{.*}}
|
|
|
|
print *, c
|
|
! CHECK: %[[shape:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: fir.embox %[[decl]]#1(%[[shape]]) : (!fir.ref<!fir.array<?x!fir.char<1,10>>>, !fir.shapeshift<1>) -> !fir.box<!fir.array<?x!fir.char<1,10>>>
|
|
end subroutine
|
|
|
|
! Assumed length
|
|
! CHECK-LABEL: func @_QPtest_assumed_shape_char_2(%arg0: !fir.box<!fir.array<?x!fir.char<1,?>>> {fir.bindc_name = "c", fir.contiguous})
|
|
subroutine test_assumed_shape_char_2(c)
|
|
character(*), contiguous :: c(:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> !fir.ref<!fir.array<?x!fir.char<1,?>>>
|
|
! CHECK: %[[len:.*]] = fir.box_elesize %arg0 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> index
|
|
|
|
! CHECK: %[[dims:.*]]:3 = fir.box_dims %arg0, %c0 : (!fir.box<!fir.array<?x!fir.char<1,?>>>, index) -> (index, index, index)
|
|
! CHECK: %[[c1:.*]] = arith.constant 1 : index
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) typeparams %[[len]] {{.*}}
|
|
|
|
print *, c
|
|
! CHECK: %[[shape:.*]] = fir.shape_shift %[[c1]], %[[dims]]#1 : (index, index) -> !fir.shapeshift<1>
|
|
! CHECK: fir.embox %[[decl]]#1(%[[shape]]) typeparams %[[len]] : (!fir.ref<!fir.array<?x!fir.char<1,?>>>, !fir.shapeshift<1>, index) -> !fir.box<!fir.array<?x!fir.char<1,?>>>
|
|
end subroutine
|
|
|
|
|
|
! lower bounds all 1.
|
|
! CHECK: func @_QPtest_assumed_shape_char_3(%arg0: !fir.box<!fir.array<?x?x!fir.char<1,?>>> {fir.bindc_name = "c", fir.contiguous})
|
|
subroutine test_assumed_shape_char_3(c)
|
|
character(*), contiguous :: c(1:, 1:)
|
|
! CHECK: %[[addr:.*]] = fir.box_addr %arg0
|
|
! CHECK: %[[len:.*]] = fir.box_elesize %arg0
|
|
! CHECK: %[[dims1:.*]]:3 = fir.box_dims %arg0, %c0
|
|
! CHECK: %[[dims2:.*]]:3 = fir.box_dims %arg0, %c1
|
|
! CHECK: %[[shape_decl:.*]] = fir.shape %[[dims1]]#1, %[[dims2]]#1
|
|
! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[addr]](%[[shape_decl]]) typeparams %[[len]] {{.*}}
|
|
print *, c
|
|
! CHECK: fir.call @_FortranAioBeginExternalListOutput
|
|
! CHECK: %[[shape:.*]] = fir.shape %[[dims1]]#1, %[[dims2]]#1
|
|
! CHECK: fir.embox %[[decl]]#1(%[[shape]]) typeparams %[[len]]
|
|
end subroutine
|