Files
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

181 lines
7.3 KiB
Fortran

! Test lowering of Cray pointee references.
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "TEST_CRAY_POINTERS_02"}
program test_cray_pointers_02
implicit none
! CHECK: fir.call @_QPnone_shared() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPnone_private() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPnone_firstprivate() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPprivate_shared() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPprivate_firstprivate() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPfirstprivate_shared() fastmath<contract> : () -> ()
! CHECK: fir.call @_QPfirstprivate_private() fastmath<contract> : () -> ()
call none_shared()
call none_private()
call none_firstprivate()
call private_shared()
call private_firstprivate()
call firstprivate_shared()
call firstprivate_private()
! CHECK: return
! CHECK: }
end program test_cray_pointers_02
! CHECK-LABEL: func.func @_QPnone_shared()
subroutine none_shared()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(none) shared(ivar)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = arith.divsi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) / 2
print '(A24,I6)', 'none_shared', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPnone_private()
subroutine none_private()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(none) private(ivar) shared(pointee)
! CHECK: omp.parallel
ivar = loc(pointee)
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = arith.addi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) + 2
print '(A24,I6)', 'none_private', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPnone_firstprivate()
subroutine none_firstprivate()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(none) firstprivate(ivar)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = arith.muli
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) * 2
print '(A24,I6)', 'none_firstprivate', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPprivate_shared()
subroutine private_shared()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(private) shared(ivar)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = math.ipowi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) ** 2
print '(A24,I6)', 'private_shared', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPprivate_firstprivate()
subroutine private_firstprivate()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(private) firstprivate(ivar)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = arith.subi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) - 2
print '(A24,I6)', 'private_firstprivate', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPfirstprivate_shared()
subroutine firstprivate_shared()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(firstprivate) shared(ivar)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = arith.divsi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
var(1) = var(1) / 2
print '(A24,I6)', 'firstprivate_shared', var(1)
!$omp end parallel
! CHECK: return
end subroutine
! CHECK-LABEL: func.func @_QPfirstprivate_private()
subroutine firstprivate_private()
implicit none
integer var(*)
pointer(ivar,var)
integer pointee(8)
pointee(1) = 42
ivar = loc(pointee)
!$omp parallel num_threads(1) default(firstprivate) private(ivar) shared(pointee)
! CHECK: omp.parallel
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: {{.*}} = math.ipowi
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.llvm_ptr<i8>) -> ()
ivar = loc(pointee)
var(1) = var(1) ** 2
print '(A24,I6)', 'firstprivate_private', var(1)
!$omp end parallel
! CHECK: return
end subroutine