Files
TheRock/compiler/amd-llvm/flang/test/Parser/OpenMP/target_device_parse.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

182 lines
6.4 KiB
Fortran

! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -fdebug-unparse-no-sema %openmp_flags %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree %openmp_flags %s | FileCheck --check-prefix="PARSE-TREE" %s
! Checks the parsing of Openmp 5.0 Target Device constructs
!
PROGRAM main
USE OMP_LIB
IMPLICIT NONE
INTEGER :: X, Y
INTEGER :: M = 1
!------------------------------------------------------
! Check Device clause with a constant argument
!------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(1)
!$OMP TARGET DEVICE(1)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
! Check Device clause with a constant integer expression argument
!------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(2-1)
!$OMP TARGET DEVICE(2-1)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: Subtract
!PARSE-TREE: Expr = '2_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
! Check Device clause with a variable argument
!------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(X)
!$OMP TARGET DEVICE(X)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
! Check Device clause with an variable integer expression
!------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(X+Y)
!$OMP TARGET DEVICE(X+Y)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
!PARSE-TREE: Add
!PARSE-TREE: Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
! Check Device Ancestor clause with a constant argument
!------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(ANCESTOR: 1)
!$OMP TARGET DEVICE(ANCESTOR: 1)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!--------------------------------------------------------
! Check Device Devive-Num clause with a constant argument
!--------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(DEVICE_NUM: 2)
!$OMP TARGET DEVICE(DEVICE_NUM: 2)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = '2_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!-------------------------------------------------------------------
! Check Device Ancestor clause with a variable expression argument
!-------------------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(ANCESTOR: X+Y)
!$OMP TARGET DEVICE(ANCESTOR: X + Y)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
!PARSE-TREE: Add
!PARSE-TREE: Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!-------------------------------------------------------------------
! Check Device Devive-Num clause with a variable expression argument
!-------------------------------------------------------------------
!CHECK: !$OMP TARGET DEVICE(DEVICE_NUM: X-Y)
!$OMP TARGET DEVICE(DEVICE_NUM: X - Y)
M = M + 1
!CHECK: !$OMP END TARGET
!$OMP END TARGET
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = 'x-y'
!PARSE-TREE: Subtract
!PARSE-TREE: Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
END PROGRAM