46 lines · plain
1! Test -flang-deprecated-hlfir, -flang-experimental-hlfir (flang), and2! -hlfir (bbc), -emit-hlfir, -emit-fir flags3! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s4! RUN: bbc -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s5! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s6! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s7! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s8! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL9! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck %s --check-prefix FIR --check-prefix ALL10! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s11! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL12 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 21subroutine test(a, res)22 real :: a(:), res23 res = SUM(a)24end subroutine25! ALL-LABEL: func.func @_QPtest26! 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 lowering31! FIR: %[[A_VAR:.*]] = fir.declare %[[A]]32! NO-HLFIR-NOT: fir.declare33 34! HLFIR-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]35! FIR: %[[RES_VAR:.*]] = fir.declare %[[RES]]36! NO-HLFIR-NOT: fir.declare37 38! HLFIR-NEXT: %[[SUM_RES:.*]] = hlfir.sum %[[A_VAR]]#039! HLFIR-NEXT: hlfir.assign %[[SUM_RES]] to %[[RES_VAR]]#040! FIR-NOT: hlfir.41! NO-HLFIR-NOT: hlfir.42 43! ALL: return44! ALL-NEXT: }45 46