1 // Test hlfir.noreassoc code generation to FIR.
3 // RUN: fir-opt %s -bufferize-hlfir -convert-hlfir-to-fir | FileCheck %s
5 func.func @no_reassoc_expr(%addr: !fir.ref<!fir.char<1,?>>, %len: index) {
6 %0:2 = hlfir.declare %addr typeparams %len {uniq_name = "c"} : (!fir.ref<!fir.char<1,?>>, index) -> (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
7 %1 = hlfir.as_expr %0#0 : (!fir.boxchar<1>) -> !hlfir.expr<!fir.char<1,?>>
8 %2 = hlfir.no_reassoc %1 : !hlfir.expr<!fir.char<1,?>>
11 // CHECK: %[[VAL_4:.*]] = fir.alloca !fir.char<1,?>
12 // CHECK: %[[VAL_5:.*]] = fir.declare %[[VAL_4]] {{.*}}
13 // CHECK: %[[VAL_6:.*]] = fir.emboxchar %[[VAL_5]], %{{.*}}
14 // CHECK: fir.no_reassoc %[[VAL_6]] : !fir.boxchar<1>
16 func.func @no_reassoc_var(%addr: !fir.ref<!fir.char<1,?>>, %len: index) {
17 %0:2 = hlfir.declare %addr typeparams %len {uniq_name = "c"} : (!fir.ref<!fir.char<1,?>>, index) -> (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
18 %1 = hlfir.no_reassoc %0#0 : !fir.boxchar<1>
21 // CHECK-LABEL: func.func @no_reassoc_var(
22 // CHECK: %[[VAL_3:.*]] = fir.emboxchar
23 // CHECK: fir.no_reassoc %[[VAL_3]] : !fir.boxchar<1>
25 func.func @no_reassoc_value(%arg0 : i32) {
26 %0 = hlfir.no_reassoc %arg0 : i32
29 // CHECK-LABEL: func.func @no_reassoc_value(
30 // CHECK-SAME: %[[VAL_0:.*]]: i32) {
31 // CHECK: fir.no_reassoc %[[VAL_0]] : i32