Files
TheRock/compiler/amd-llvm/flang/test/Lower/Intrinsics/spread.f90
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

73 lines
4.3 KiB
Fortran

! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
module spread_mod
type :: p1
integer :: a
end type
type, extends(p1) :: p2
integer :: b
end type
contains
! CHECK-LABEL: func @_QMspread_modPspread_test(
! CHECK-SAME: %[[arg0:[^:]+]]: !fir.ref<i32>{{.*}}, %[[arg1:[^:]+]]: !fir.ref<i32>{{.*}}, %[[arg2:[^:]+]]: !fir.ref<i32>{{.*}}, %[[arg3:.*]]: !fir.box<!fir.array<?xi32>>{{.*}}) {
subroutine spread_test(s,d,n,r)
integer :: s,d,n
integer :: r(:)
! CHECK-DAG: %[[a0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xi32>>>
! CHECK-DAG: %[[d_decl:.*]]:2 = hlfir.declare %[[arg1]]
! CHECK-DAG: %[[n_decl:.*]]:2 = hlfir.declare %[[arg2]]
! CHECK-DAG: %[[s_decl:.*]]:2 = hlfir.declare %[[arg0]]
! CHECK-DAG: %[[a1:.*]] = fir.load %[[d_decl]]#0 : !fir.ref<i32>
! CHECK-DAG: %[[a2:.*]] = fir.load %[[n_decl]]#0 : !fir.ref<i32>
! CHECK-DAG: %[[a3:.*]] = fir.embox %[[s_decl]]#0 : (!fir.ref<i32>) -> !fir.box<i32>
! CHECK-DAG: %[[a8:.*]] = fir.convert %[[a0]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> !fir.ref<!fir.box<none>>
! CHECK-DAG: %[[a9:.*]] = fir.convert %[[a3]] : (!fir.box<i32>) -> !fir.box<none>
! CHECK-DAG: %[[a10:.*]] = fir.convert %[[a2]] : (i32) -> i64
r = spread(s,d,n)
! CHECK: fir.call @_FortranASpread(%[[a8]], %[[a9]], %[[a1]], %[[a10]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, i32, i64, !fir.ref<i8>, i32) -> ()
! CHECK: hlfir.assign %{{.*}} to %{{.*}}
end subroutine
! CHECK-LABEL: func @_QMspread_modPspread_test2(
! CHECK-SAME: %[[arg0:.*]]: !fir.box<!fir.array<?xi32>>{{.*}}, %[[arg1:[^:]+]]: !fir.ref<i32>{{.*}}, %[[arg2:[^:]+]]: !fir.ref<i32>{{.*}}, %[[arg3:.*]]: !fir.box<!fir.array<?x?xi32>>{{.*}}) {
subroutine spread_test2(s,d,n,r)
integer :: s(:),d,n
integer :: r(:,:)
! CHECK-DAG: %[[a0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xi32>>>
! CHECK-DAG: %[[d_decl:.*]]:2 = hlfir.declare %[[arg1]]
! CHECK-DAG: %[[n_decl:.*]]:2 = hlfir.declare %[[arg2]]
! CHECK-DAG: %[[s_decl:.*]]:2 = hlfir.declare %[[arg0]]
! CHECK-DAG: %[[a1:.*]] = fir.load %[[d_decl]]#0 : !fir.ref<i32>
! CHECK-DAG: %[[a2:.*]] = fir.load %[[n_decl]]#0 : !fir.ref<i32>
! CHECK-DAG: %[[a7:.*]] = fir.convert %[[a0]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?xi32>>>>) -> !fir.ref<!fir.box<none>>
! CHECK-DAG: %[[a8:.*]] = fir.convert %[[s_decl]]#1 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>
! CHECK-DAG: %[[a9:.*]] = fir.convert %[[a2]] : (i32) -> i64
r = spread(s,d,n)
! CHECK: fir.call @_FortranASpread(%[[a7]], %[[a8]], %[[a1]], %[[a9]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, i32, i64, !fir.ref<i8>, i32) -> ()
! CHECK: hlfir.assign %{{.*}} to %{{.*}}
end subroutine
! CHECK-LABEL: func.func @_QMspread_modPspread_test_polymorphic_source(
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.class<!fir.ptr<!fir.array<?x?xnone>>>> {fir.bindc_name = "p"}) {
subroutine spread_test_polymorphic_source(p)
class(*), pointer :: p(:,:)
class(*), allocatable :: r(:,:,:)
r = spread(p(:,::2), dim=1, ncopies=2)
! CHECK: %[[res:.*]] = fir.alloca !fir.class<!fir.heap<!fir.array<?x?x?xnone>>>
! CHECK: %[[p_decl:.*]]:2 = hlfir.declare %[[arg0]]
! CHECK: %[[load_p:.*]] = fir.load %[[p_decl]]#0 : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x?xnone>>>>
! CHECK: %[[source_box:.*]] = hlfir.designate %[[load_p]] (%{{.*}}:%{{.*}}:%{{.*}}, %{{.*}}:%{{.*}}:%{{.*}}) shape %{{.*}} : (!fir.class<!fir.ptr<!fir.array<?x?xnone>>>, {{.*}}) -> !fir.class<!fir.array<?x?xnone>>
! CHECK: %[[embox:.*]] = fir.embox %{{.*}}(%{{.*}}) source_box %[[source_box]] : (!fir.heap<!fir.array<?x?x?xnone>>, !fir.shape<3>, !fir.class<!fir.array<?x?xnone>>) -> !fir.class<!fir.heap<!fir.array<?x?x?xnone>>>
! CHECK: fir.store %[[embox]] to %[[res]] : !fir.ref<!fir.class<!fir.heap<!fir.array<?x?x?xnone>>>>
! CHECK: %[[res_box_none:.*]] = fir.convert %[[res]] : (!fir.ref<!fir.class<!fir.heap<!fir.array<?x?x?xnone>>>>) -> !fir.ref<!fir.box<none>>
! CHECK: %[[source_box_none:.*]] = fir.convert %[[source_box]] : (!fir.class<!fir.array<?x?xnone>>) -> !fir.box<none>
! CHECK: fir.call @_FortranASpread(%[[res_box_none]], %[[source_box_none]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.box<none>, i32, i64, !fir.ref<i8>, i32) -> ()
end subroutine
end module