|
| 1 | +!===----------------------------------------------------------------------===! |
| 2 | +! This directory can be used to add Integration tests involving multiple |
| 3 | +! stages of the compiler (for eg. from Fortran to LLVM IR). It should not |
| 4 | +! contain executable tests. We should only add tests here sparingly and only |
| 5 | +! if there is no other way to test. Repeat this message in each test that is |
| 6 | +! added to this directory and sub-directories. |
| 7 | +!===----------------------------------------------------------------------===! |
| 8 | + |
| 9 | +!RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR |
| 10 | +!RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR |
| 11 | + |
| 12 | +subroutine sb1(a, x) |
| 13 | + integer :: a |
| 14 | + integer :: x(:) |
| 15 | + !$omp parallel workshare |
| 16 | + x = a |
| 17 | + !$omp end parallel workshare |
| 18 | +end subroutine |
| 19 | + |
| 20 | +! HLFIR: omp.parallel { |
| 21 | +! HLFIR: omp.workshare { |
| 22 | +! HLFIR: %[[SCALAR:.*]] = fir.load %1#0 : !fir.ref<i32> |
| 23 | +! HLFIR: hlfir.assign %[[SCALAR]] to |
| 24 | +! HLFIR: omp.terminator |
| 25 | +! HLFIR: } |
| 26 | +! HLFIR: omp.terminator |
| 27 | +! HLFIR: } |
| 28 | + |
| 29 | +! FIR: omp.parallel { |
| 30 | +! FIR: %[[SCALAR_ALLOCA:.*]] = fir.alloca i32 |
| 31 | +! FIR: omp.single copyprivate(%[[SCALAR_ALLOCA]] -> @_workshare_copy_i32 : !fir.ref<i32>) { |
| 32 | +! FIR: %[[SCALAR_LOAD:.*]] = fir.load %{{.*}} : !fir.ref<i32> |
| 33 | +! FIR: fir.store %[[SCALAR_LOAD]] to %[[SCALAR_ALLOCA]] : !fir.ref<i32> |
| 34 | +! FIR: omp.terminator |
| 35 | +! FIR: } |
| 36 | +! FIR: %[[SCALAR_RELOAD:.*]] = fir.load %[[SCALAR_ALLOCA]] : !fir.ref<i32> |
| 37 | +! FIR: %6:3 = fir.box_dims %3, %c0 : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index) |
| 38 | +! FIR: omp.wsloop nowait { |
| 39 | +! FIR: omp.loop_nest (%arg2) : index = (%c1) to (%6#1) inclusive step (%c1) { |
| 40 | +! FIR: fir.store %[[SCALAR_RELOAD]] |
| 41 | +! FIR: omp.yield |
| 42 | +! FIR: } |
| 43 | +! FIR: omp.terminator |
| 44 | +! FIR: } |
| 45 | +! FIR: omp.barrier |
| 46 | +! FIR: omp.terminator |
0 commit comments