Skip to content

[Flang] Add new Integration tests directory to Flang #73141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions flang/test/Driver/OpenMP/host-ir-flag.f90

This file was deleted.

14 changes: 14 additions & 0 deletions flang/test/Integration/OpenMP/host-ir-flag.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
!===----------------------------------------------------------------------===!
! 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-bc -fopenmp -o %t.bc %s 2>&1
!RUN: %flang_fc1 -emit-mlir -fopenmp -fopenmp-is-target-device -fopenmp-host-ir-file-path %t.bc -o - %s 2>&1 | FileCheck %s

!CHECK: module attributes {{{.*}}, omp.host_ir_filepath = "{{.*}}.bc", omp.is_gpu = false, omp.is_target_device = true{{.*}}}
subroutine omp_subroutine()
end subroutine omp_subroutine
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
!===----------------------------------------------------------------------===!
! 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 -flang-deprecated-no-hlfir %s -o - | FileCheck %s

!===============================================================================
Expand Down
69 changes: 69 additions & 0 deletions flang/test/Integration/OpenMP/target-filtering.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
!===----------------------------------------------------------------------===!
! 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-prefixes HOST,ALL
!RUN: %flang_fc1 -emit-llvm -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefixes DEVICE,ALL

!HOST: define {{.*}}@{{.*}}before{{.*}}(
!DEVICE-NOT: define {{.*}}@before{{.*}}(
!DEVICE-NOT: declare {{.*}}@before{{.*}}
integer function before(x)
integer, intent(in) :: x
before = x + 200
end function

!ALL: define {{.*}}@{{.*}}main{{.*}}(
program main
integer :: x, before, after
!$omp target map(tofrom : x)
x = 100
!$omp end target
!HOST: call {{.*}}@{{.*}}before{{.*}}(
!DEVICE-NOT: call {{.*}}@before{{.*}}(
!HOST: call {{.*}}@{{.*}}after{{.*}}(
!DEVICE-NOT: call {{.*}}@after{{.*}}(
x = x + before(x) + after(x)
end program

!HOST: define {{.*}}@{{.*}}after{{.*}}(
!DEVICE-NOT: define {{.*}}@after{{.*}}(
!DEVICE-NOT: declare {{.*}}@after{{.*}}
integer function after(x)
integer, intent(in) :: x
after = x + 300
end function

!ALL: define {{.*}}@{{.*}}before_target{{.*}}(
subroutine before_target(x)
integer, intent(out) :: x
!$omp target map(from: x)
x = 1
!$omp end target
end subroutine

!ALL: define {{.*}}@{{.*}}middle{{.*}}(
subroutine middle()
integer :: x
!$omp target map(from: x)
x = 0
!$omp end target
!HOST: call {{.*}}@{{.*}}before_target{{.*}}(
!DEVICE-NOT: call {{.*}}@{{.*}}before_target{{.*}}(
!HOST: call {{.*}}@{{.*}}after_target{{.*}}(
!DEVICE-NOT: call {{.*}}@{{.*}}after_target{{.*}}(
call before_target(x)
call after_target(x)
end subroutine

!ALL: define {{.*}}@{{.*}}after_target{{.*}}(
subroutine after_target(x)
integer, intent(out) :: x
!$omp target map(from:x)
x = 2
!$omp end target
end subroutine
3 changes: 3 additions & 0 deletions flang/test/Integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Flang Integration Tests

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.