| 1 |
! Test -flang-deprecated-hlfir, -flang-experimental-hlfir (flang-new), and |
| 2 |
! -hlfir (bbc), -emit-hlfir, -emit-fir flags |
| 3 |
! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s |
| 4 |
! RUN: bbc -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s |
| 5 |
! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s |
| 6 |
! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s |
| 7 |
! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s |
| 8 |
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL |
| 9 |
! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck %s --check-prefix FIR --check-prefix ALL |
| 10 |
! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s |
| 11 |
! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL |
| 12 |
|
| 13 |
! | Action | -flang-deprecated-no-hlfir | Result | |
| 14 |
! | | / -hlfir=false? | | |
| 15 |
! | =========== | =========================== | =============================== | |
| 16 |
! | -emit-hlfir | N | Outputs HLFIR | |
| 17 |
! | -emit-hlfir | Y | Outputs HLFIR | |
| 18 |
! | -emit-fir | N | Outputs FIR, lowering via HLFIR | |
| 19 |
! | -emit-fir | Y | Outputs FIR, using old lowering | |
| 20 |
|
| 21 |
subroutine test(a, res) |
| 22 |
real :: a(:), res |
| 23 |
res = SUM(a) |
| 24 |
end subroutine |
| 25 |
! ALL-LABEL: func.func @_QPtest |
| 26 |
! ALL: %[[A:.*]]: !fir.box<!fir.array<?xf32>> |
| 27 |
! ALL: %[[RES:.*]]: !fir.ref<f32> |
| 28 |
|
| 29 |
! HLFIR: %[[A_VAR:.*]]:2 = hlfir.declare %[[A]] |
| 30 |
! fir.declare is only generated via the hlfir -> fir lowering |
| 31 |
! FIR: %[[A_VAR:.*]] = fir.declare %[[A]] |
| 32 |
! NO-HLFIR-NOT: fir.declare |
| 33 |
|
| 34 |
! HLFIR-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]] |
| 35 |
! FIR: %[[RES_VAR:.*]] = fir.declare %[[RES]] |
| 36 |
! NO-HLFIR-NOT: fir.declare |
| 37 |
|
| 38 |
! HLFIR-NEXT: %[[SUM_RES:.*]] = hlfir.sum %[[A_VAR]]#0 |
| 39 |
! HLFIR-NEXT: hlfir.assign %[[SUM_RES]] to %[[RES_VAR]]#0 |
| 40 |
! FIR-NOT: hlfir. |
| 41 |
! NO-HLFIR-NOT: hlfir. |
| 42 |
|
| 43 |
! ALL: return |
| 44 |
! ALL-NEXT: } |
| 45 |
|