[LLVM] Fix Maintainers.md formatting (NFC)
[llvm-project.git] / flang / test / HLFIR / hlfir-flags.f90
blob0b1e80b1e3f636f1cfb3820892802cb4b6a789f9
1 ! Test -flang-deprecated-hlfir, -flang-experimental-hlfir (flang), 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
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 |
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>
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
34 ! HLFIR-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]
35 ! FIR: %[[RES_VAR:.*]] = fir.declare %[[RES]]
36 ! NO-HLFIR-NOT: fir.declare
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.
43 ! ALL: return
44 ! ALL-NEXT: }