blob: 477c09aa614d418b4054ac301893a5d36682d28a [file]
!===----------------------------------------------------------------------===!
! This directory can be used to add Integration tests involving multiple
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
! contain executable tests. We should only add tests here sparingly and only
! if there is no other way to test. Repeat this message in each test that is
! added to this directory and sub-directories.
!===----------------------------------------------------------------------===!
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefix=NORT
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefix=LLVM
!Make sure that there are no calls to the mapper.
!NORT-NOT: call{{.*}}__tgt_target_data_begin_mapper
!NORT-NOT: call{{.*}}__tgt_target_data_end_mapper
!Make sure we generate the body
!LLVM: define internal void @_QFPf(ptr noalias %[[A0:[0-9]+]], ptr noalias %[[A1:[0-9]+]])
!LLVM: %[[V0:[0-9]+]] = load i32, ptr %[[A0]], align 4
!LLVM: %[[V1:[0-9]+]] = load i32, ptr %[[A1]], align 4
!LLVM: %[[V2:[0-9]+]] = add i32 %[[V0]], %[[V1]]
!LLVM: store i32 %[[V2]], ptr %[[A0]], align 4
!LLVM: ret void
!LLVM: }
program test
call f(1, 2)
contains
subroutine f(x, y)
integer :: x, y
type :: t
integer, pointer :: p(:)
end type
type(t) :: d
!$omp target data map(tofrom: x, y)
x = x + y
!$omp end target data
!$omp target enter data map(to: d)
!$omp target exit data map(release: d)
end subroutine
end