| 1 |
!This test checks that when compiling an OpenMP program for the target device |
| 2 |
!CSE is not done across target op region boundaries. It also checks that when |
| 3 |
!compiling for the host CSE is done. |
| 4 |
!RUN: %flang_fc1 -fopenmp-is-target-device -emit-mlir -fopenmp %s -o - | fir-opt -cse | FileCheck %s -check-prefix=CHECK-DEVICE |
| 5 |
!RUN: %flang_fc1 -emit-mlir -fopenmp %s -o - | fir-opt -cse | FileCheck %s -check-prefix=CHECK-HOST |
| 6 |
!RUN: bbc -fopenmp-is-target-device -emit-fir -fopenmp %s -o - | fir-opt -cse | FileCheck %s -check-prefix=CHECK-DEVICE |
| 7 |
!RUN: bbc -emit-fir -fopenmp %s -o - | fir-opt -cse | FileCheck %s -check-prefix=CHECK-HOST |
| 8 |
|
| 9 |
!Constant should be present inside target region. |
| 10 |
!CHECK-DEVICE: omp.target |
| 11 |
!CHECK-DEVICE: arith.constant 10 |
| 12 |
!CHECK-DEVICE: omp.terminator |
| 13 |
|
| 14 |
!Constant should not be present inside target region. |
| 15 |
!CHECK-HOST: omp.target |
| 16 |
!CHECK-NOT-HOST: arith.constant 10 |
| 17 |
!CHECK-HOST: omp.terminator |
| 18 |
|
| 19 |
subroutine writeIndex(sum) |
| 20 |
integer :: sum |
| 21 |
integer :: myconst1 |
| 22 |
integer :: myconst2 |
| 23 |
myconst1 = 10 |
| 24 |
!$omp target map(from:myconst2) |
| 25 |
myconst2 = 10 |
| 26 |
!$omp end target |
| 27 |
sum = myconst2 + myconst2 |
| 28 |
end subroutine writeIndex |