[flang-commits] [flang] [flang][NFC] Converted five tests from old lowering to new lowering (part 25) (PR #184720)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 4 18:00:56 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Eugene Epshteyn (eugeneepshteyn)
<details>
<summary>Changes</summary>
Tests converted from test/Lower/Intrinsics: bessel_yn.f90, bge.f90, bgt.f90, ble.f90, blt.f90
---
Patch is 84.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/184720.diff
5 Files Affected:
- (modified) flang/test/Lower/Intrinsics/bessel_yn.f90 (+77-66)
- (modified) flang/test/Lower/Intrinsics/bge.f90 (+100-59)
- (modified) flang/test/Lower/Intrinsics/bgt.f90 (+100-59)
- (modified) flang/test/Lower/Intrinsics/ble.f90 (+100-59)
- (modified) flang/test/Lower/Intrinsics/blt.f90 (+100-59)
``````````diff
diff --git a/flang/test/Lower/Intrinsics/bessel_yn.f90 b/flang/test/Lower/Intrinsics/bessel_yn.f90
index 2097fb9006ff5..2ce0fe3c6e5b7 100644
--- a/flang/test/Lower/Intrinsics/bessel_yn.f90
+++ b/flang/test/Lower/Intrinsics/bessel_yn.f90
@@ -1,116 +1,127 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=fast | FileCheck --check-prefixes=ALL %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=fast %s -o - | FileCheck --check-prefixes=ALL %s
-! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=relaxed | FileCheck --check-prefixes=ALL %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=relaxed %s -o - | FileCheck --check-prefixes=ALL %s
-! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=precise | FileCheck --check-prefixes=ALL %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=precise %s -o - | FileCheck --check-prefixes=ALL %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - -mllvm -math-runtime=fast | FileCheck --check-prefixes=ALL %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - -mllvm -math-runtime=relaxed | FileCheck --check-prefixes=ALL %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - -mllvm -math-runtime=precise | FileCheck --check-prefixes=ALL %s
-! ALL-LABEL: @_QPtest_real4
-! ALL-SAME: (%[[argx:.*]]: !fir.ref<f32>{{.*}}, %[[argn:.*]]: !fir.ref<i32>{{.*}}) -> f32
+! ALL-LABEL: func.func @_QPtest_real4
+! ALL-SAME: (%[[argx:.*]]: !fir.ref<f32> {fir.bindc_name = "x"}, %[[argn:.*]]: !fir.ref<i32> {fir.bindc_name = "n"}) -> f32 {
function test_real4(x, n)
real :: x, test_real4
integer :: n
- ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f32>
- ! ALL-DAG: %[[n:.*]] = fir.load %[[argn]] : !fir.ref<i32>
+ ! ALL: %[[scope:.*]] = fir.dummy_scope : !fir.dscope
+ ! ALL: %[[n_decl:.*]]:2 = hlfir.declare %[[argn]] dummy_scope %[[scope]] arg 2 {uniq_name = "_QFtest_real4En"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[res_alloc:.*]] = fir.alloca f32 {bindc_name = "test_real4", uniq_name = "_QFtest_real4Etest_real4"}
+ ! ALL: %[[res_decl:.*]]:2 = hlfir.declare %[[res_alloc]] {uniq_name = "_QFtest_real4Etest_real4"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
+ ! ALL: %[[x_decl:.*]]:2 = hlfir.declare %[[argx]] dummy_scope %[[scope]] arg 1 {uniq_name = "_QFtest_real4Ex"} : (!fir.ref<f32>, !fir.dscope) -> (!fir.ref<f32>, !fir.ref<f32>)
+ ! ALL-DAG: %[[n:.*]] = fir.load %[[n_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[x:.*]] = fir.load %[[x_decl]]#0 : !fir.ref<f32>
! ALL: fir.call @ynf(%[[n]], %[[x]]) {{.*}} : (i32, f32) -> f32
test_real4 = bessel_yn(n, x)
end function
-! ALL-LABEL: @_QPtest_real8
-! ALL-SAME: (%[[argx:.*]]: !fir.ref<f64>{{.*}}, %[[argn:.*]]: !fir.ref<i32>{{.*}}) -> f64
+! ALL-LABEL: func.func @_QPtest_real8
+! ALL-SAME: (%[[argx:.*]]: !fir.ref<f64> {fir.bindc_name = "x"}, %[[argn:.*]]: !fir.ref<i32> {fir.bindc_name = "n"}) -> f64 {
function test_real8(x, n)
real(8) :: x, test_real8
integer :: n
- ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f64>
- ! ALL-DAG: %[[n:.*]] = fir.load %[[argn]] : !fir.ref<i32>
+ ! ALL: %[[scope:.*]] = fir.dummy_scope : !fir.dscope
+ ! ALL: %[[n_decl:.*]]:2 = hlfir.declare %[[argn]] dummy_scope %[[scope]] arg 2 {uniq_name = "_QFtest_real8En"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[res_alloc:.*]] = fir.alloca f64 {bindc_name = "test_real8", uniq_name = "_QFtest_real8Etest_real8"}
+ ! ALL: %[[res_decl:.*]]:2 = hlfir.declare %[[res_alloc]] {uniq_name = "_QFtest_real8Etest_real8"} : (!fir.ref<f64>) -> (!fir.ref<f64>, !fir.ref<f64>)
+ ! ALL: %[[x_decl:.*]]:2 = hlfir.declare %[[argx]] dummy_scope %[[scope]] arg 1 {uniq_name = "_QFtest_real8Ex"} : (!fir.ref<f64>, !fir.dscope) -> (!fir.ref<f64>, !fir.ref<f64>)
+ ! ALL-DAG: %[[n:.*]] = fir.load %[[n_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[x:.*]] = fir.load %[[x_decl]]#0 : !fir.ref<f64>
! ALL: fir.call @yn(%[[n]], %[[x]]) {{.*}} : (i32, f64) -> f64
test_real8 = bessel_yn(n, x)
end function
-! ALL-LABEL: @_QPtest_transformational_real4
-! ALL-SAME: %[[argx:.*]]: !fir.ref<f32>{{.*}}, %[[argn1:.*]]: !fir.ref<i32>{{.*}}, %[[argn2:.*]]: !fir.ref<i32>{{.*}}
+! ALL-LABEL: func.func @_QPtest_transformational_real4
+! ALL-SAME: (%[[argx:.*]]: !fir.ref<f32> {fir.bindc_name = "x"}, %[[argn1:.*]]: !fir.ref<i32> {fir.bindc_name = "n1"}, %[[argn2:.*]]: !fir.ref<i32> {fir.bindc_name = "n2"}, %[[argr:.*]]: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "r"}) {
subroutine test_transformational_real4(x, n1, n2, r)
real(4) :: x
integer :: n1, n2
real(4) :: r(:)
- ! ALL-DAG: %[[zero:.*]] = arith.constant 0{{.*}} : f32
- ! ALL-DAG: %[[one:.*]] = arith.constant 1 : i32
- ! ALL-DAG: %[[r:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>>
- ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f32>
- ! ALL-DAG: %[[n1:.*]] = fir.load %[[argn1]] : !fir.ref<i32>
- ! ALL-DAG: %[[n2:.*]] = fir.load %[[argn2]] : !fir.ref<i32>
- ! ALL-DAG: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f32
- ! ALL-DAG: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i32
- ! ALL-DAG: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i32
+ ! ALL: %[[temp:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>>
+ ! ALL: %[[scope:.*]] = fir.dummy_scope : !fir.dscope
+ ! ALL: %[[n1_decl:.*]]:2 = hlfir.declare %[[argn1]] dummy_scope %[[scope]] arg 2 {uniq_name = "_QFtest_transformational_real4En1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[n2_decl:.*]]:2 = hlfir.declare %[[argn2]] dummy_scope %[[scope]] arg 3 {uniq_name = "_QFtest_transformational_real4En2"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[r_decl:.*]]:2 = hlfir.declare %[[argr]] dummy_scope %[[scope]] arg 4 {uniq_name = "_QFtest_transformational_real4Er"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> (!fir.box<!fir.array<?xf32>>, !fir.box<!fir.array<?xf32>>)
+ ! ALL: %[[x_decl:.*]]:2 = hlfir.declare %[[argx]] dummy_scope %[[scope]] arg 1 {uniq_name = "_QFtest_transformational_real4Ex"} : (!fir.ref<f32>, !fir.dscope) -> (!fir.ref<f32>, !fir.ref<f32>)
+ ! ALL-DAG: %[[n1:.*]] = fir.load %[[n1_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[n2:.*]] = fir.load %[[n2_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[x:.*]] = fir.load %[[x_decl]]#0 : !fir.ref<f32>
+ ! ALL: %[[zero:.*]] = arith.constant 0{{.*}} : f32
+ ! ALL: %[[one:.*]] = arith.constant 1 : i32
+ ! ALL: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f32
+ ! ALL: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i32
+ ! ALL: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i32
! ALL: fir.if %[[xeq0]] {
- ! ALL: %[[resxeq0:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resxeq0:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYnX0_4(%[[resxeq0]], %[[n1]], %[[n2]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-NEXT: fir.if %[[n1ltn2]] {
+ ! ALL: } else {
+ ! ALL: fir.if %[[n1ltn2]] {
! ALL-DAG: %[[n1_1:.*]] = arith.addi %[[n1]], %[[one]] : i32
! ALL-DAG: %[[bn1:.*]] = fir.call @ynf(%[[n1]], %[[x]]) {{.*}} : (i32, f32) -> f32
! ALL-DAG: %[[bn1_1:.*]] = fir.call @ynf(%[[n1_1]], %[[x]]) {{.*}} : (i32, f32) -> f32
- ! ALL-DAG: %[[resn1ltn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resn1ltn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_4(%[[resn1ltn2]], %[[n1]], %[[n2]], %[[x]], %[[bn1]], %[[bn1_1]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-NEXT: fir.if %[[n1eqn2]] {
+ ! ALL: } else {
+ ! ALL: fir.if %[[n1eqn2]] {
! ALL-DAG: %[[bn1:.*]] = fir.call @ynf(%[[n1]], %[[x]]) {{.*}} : (i32, f32) -> f32
- ! ALL-DAG: %[[resn1eqn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resn1eqn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_4(%[[resn1eqn2]], %[[n1]], %[[n2]], %[[x]], %[[bn1]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-DAG: %[[resn1gtn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: } else {
+ ! ALL: %[[resn1gtn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_4(%[[resn1gtn2]], %[[n1]], %[[n2]], %[[x]], %[[zero]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: }
- ! ALL-NEXT: }
- ! ALL-NEXT: }
+ ! ALL: }
+ ! ALL: }
+ ! ALL: }
r = bessel_yn(n1, n2, x)
- ! ALL: %[[box:.*]] = fir.load %[[r]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
- ! ALL: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>>
- ! ALL: fir.freemem %[[addr]] : !fir.heap<!fir.array<?xf32>>
end subroutine test_transformational_real4
-! ALL-LABEL: @_QPtest_transformational_real8
-! ALL-SAME: %[[argx:.*]]: !fir.ref<f64>{{.*}}, %[[argn1:.*]]: !fir.ref<i32>{{.*}}, %[[argn2:.*]]: !fir.ref<i32>{{.*}}
+! ALL-LABEL: func.func @_QPtest_transformational_real8
+! ALL-SAME: (%[[argx:.*]]: !fir.ref<f64> {fir.bindc_name = "x"}, %[[argn1:.*]]: !fir.ref<i32> {fir.bindc_name = "n1"}, %[[argn2:.*]]: !fir.ref<i32> {fir.bindc_name = "n2"}, %[[argr:.*]]: !fir.box<!fir.array<?xf64>> {fir.bindc_name = "r"}) {
subroutine test_transformational_real8(x, n1, n2, r)
real(8) :: x
integer :: n1, n2
real(8) :: r(:)
- ! ALL-DAG: %[[zero:.*]] = arith.constant 0{{.*}} : f64
- ! ALL-DAG: %[[one:.*]] = arith.constant 1 : i32
- ! ALL-DAG: %[[r:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf64>>>
- ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f64>
- ! ALL-DAG: %[[n1:.*]] = fir.load %[[argn1]] : !fir.ref<i32>
- ! ALL-DAG: %[[n2:.*]] = fir.load %[[argn2]] : !fir.ref<i32>
- ! ALL-DAG: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f64
- ! ALL-DAG: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i32
- ! ALL-DAG: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i32
+ ! ALL: %[[temp:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf64>>>
+ ! ALL: %[[scope:.*]] = fir.dummy_scope : !fir.dscope
+ ! ALL: %[[n1_decl:.*]]:2 = hlfir.declare %[[argn1]] dummy_scope %[[scope]] arg 2 {uniq_name = "_QFtest_transformational_real8En1"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[n2_decl:.*]]:2 = hlfir.declare %[[argn2]] dummy_scope %[[scope]] arg 3 {uniq_name = "_QFtest_transformational_real8En2"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! ALL: %[[r_decl:.*]]:2 = hlfir.declare %[[argr]] dummy_scope %[[scope]] arg 4 {uniq_name = "_QFtest_transformational_real8Er"} : (!fir.box<!fir.array<?xf64>>, !fir.dscope) -> (!fir.box<!fir.array<?xf64>>, !fir.box<!fir.array<?xf64>>)
+ ! ALL: %[[x_decl:.*]]:2 = hlfir.declare %[[argx]] dummy_scope %[[scope]] arg 1 {uniq_name = "_QFtest_transformational_real8Ex"} : (!fir.ref<f64>, !fir.dscope) -> (!fir.ref<f64>, !fir.ref<f64>)
+ ! ALL-DAG: %[[n1:.*]] = fir.load %[[n1_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[n2:.*]] = fir.load %[[n2_decl]]#0 : !fir.ref<i32>
+ ! ALL-DAG: %[[x:.*]] = fir.load %[[x_decl]]#0 : !fir.ref<f64>
+ ! ALL: %[[zero:.*]] = arith.constant 0{{.*}} : f64
+ ! ALL: %[[one:.*]] = arith.constant 1 : i32
+ ! ALL: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f64
+ ! ALL: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i32
+ ! ALL: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i32
! ALL: fir.if %[[xeq0]] {
- ! ALL: %[[resxeq0:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resxeq0:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYnX0_8(%[[resxeq0]], %[[n1]], %[[n2]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-NEXT: fir.if %[[n1ltn2]] {
+ ! ALL: } else {
+ ! ALL: fir.if %[[n1ltn2]] {
! ALL-DAG: %[[n1_1:.*]] = arith.addi %[[n1]], %[[one]] : i32
! ALL-DAG: %[[bn1:.*]] = fir.call @yn(%[[n1]], %[[x]]) {{.*}} : (i32, f64) -> f64
! ALL-DAG: %[[bn1_1:.*]] = fir.call @yn(%[[n1_1]], %[[x]]) {{.*}} : (i32, f64) -> f64
- ! ALL-DAG: %[[resn1ltn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resn1ltn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_8(%[[resn1ltn2]], %[[n1]], %[[n2]], %[[x]], %[[bn1]], %[[bn1_1]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-NEXT: fir.if %[[n1eqn2]] {
+ ! ALL: } else {
+ ! ALL: fir.if %[[n1eqn2]] {
! ALL-DAG: %[[bn1:.*]] = fir.call @yn(%[[n1]], %[[x]]) {{.*}} : (i32, f64) -> f64
- ! ALL-DAG: %[[resn1eqn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: %[[resn1eqn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_8(%[[resn1eqn2]], %[[n1]], %[[n2]], %[[x]], %[[bn1]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: } else {
- ! ALL-DAG: %[[resn1gtn2:.*]] = fir.convert %[[r]] {{.*}}
+ ! ALL: } else {
+ ! ALL: %[[resn1gtn2:.*]] = fir.convert %[[temp]] {{.*}}
! ALL: fir.call @_FortranABesselYn_8(%[[resn1gtn2]], %[[n1]], %[[n2]], %[[x]], %[[zero]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()
- ! ALL-NEXT: }
- ! ALL-NEXT: }
- ! ALL-NEXT: }
+ ! ALL: }
+ ! ALL: }
+ ! ALL: }
r = bessel_yn(n1, n2, x)
- ! ALL: %[[box:.*]] = fir.load %[[r]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>
- ! ALL: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.array<?xf64>>>) -> !fir.heap<!fir.array<?xf64>>
- ! ALL: fir.freemem %[[addr]] : !fir.heap<!fir.array<?xf64>>
end subroutine test_transformational_real8
diff --git a/flang/test/Lower/Intrinsics/bge.f90 b/flang/test/Lower/Intrinsics/bge.f90
index 19ddf7d95c388..f4d05e38f6991 100644
--- a/flang/test/Lower/Intrinsics/bge.f90
+++ b/flang/test/Lower/Intrinsics/bge.f90
@@ -1,158 +1,199 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
-! CHECK-LABEL: bge_test
-! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>>{{.*}}
+! CHECK-LABEL: func.func @_QPbge_test(
+! CHECK-SAME: %[[A:.*]]: !fir.ref<i32> {{.*}}, %[[B:.*]]: !fir.ref<i32> {{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>> {{.*}}) {
subroutine bge_test(a, b, c)
integer :: a, b
logical :: c
- ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>
- ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+ ! CHECK: %[[SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+ ! CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] dummy_scope %[[SCOPE]] arg 1 {uniq_name = "_QFbge_testEa"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! CHECK: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]] dummy_scope %[[SCOPE]] arg 2 {uniq_name = "_QFbge_testEb"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! CHECK: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]] dummy_scope %[[SCOPE]] arg 3 {uniq_name = "_QFbge_testEc"} : (!fir.ref<!fir.logical<4>>, !fir.dscope) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
+ ! CHECK: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
+ ! CHECK: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
c = bge(a, b)
! CHECK: %[[C_CMP:.*]] = arith.cmpi uge, %[[A_VAL]], %[[B_VAL]] : i32
! CHECK: %[[C_VAL:.*]] = fir.convert %[[C_CMP]] : (i1) -> !fir.logical<4>
- ! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<!fir.logical<4>>
+ ! CHECK: hlfir.assign %[[C_VAL]] to %[[C_DECL]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
end subroutine bge_test
-! CHECK-LABEL: bge_test1
-! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i8>{{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>>{{.*}}
+! CHECK-LABEL: func.func @_QPbge_test1(
+! CHECK-SAME: %[[A:.*]]: !fir.ref<i8> {{.*}}, %[[B:.*]]: !fir.ref<i8> {{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>> {{.*}}) {
subroutine bge_test1(a, b, c)
integer(kind=1) :: a, b
logical :: c
- ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8>
- ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i8>
+ ! CHECK: %[[SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+ ! CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] dummy_scope %[[SCOPE]] arg 1 {uniq_name = "_QFbge_test1Ea"} : (!fir.ref<i8>, !fir.dscope) -> (!fir.ref<i8>, !fir.ref<i8>)
+ ! CHECK: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]] dummy_scope %[[SCOPE]] arg 2 {uniq_name = "_QFbge_test1Eb"} : (!fir.ref<i8>, !fir.dscope) -> (!fir.ref<i8>, !fir.ref<i8>)
+ ! CHECK: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]] dummy_scope %[[SCOPE]] arg 3 {uniq_name = "_QFbge_test1Ec"} : (!fir.ref<!fir.logical<4>>, !fir.dscope) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
+ ! CHECK: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i8>
+ ! CHECK: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i8>
c = bge(a, b)
! CHECK: %[[C_CMP:.*]] = arith.cmpi uge, %[[A_VAL]], %[[B_VAL]] : i8
! CHECK: %[[C_VAL:.*]] = fir.convert %[[C_CMP]] : (i1) -> !fir.logical<4>
- ! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<!fir.logical<4>>
+ ! CHECK: hlfir.assign %[[C_VAL]] to %[[C_DECL]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
end subroutine bge_test1
-! CHECK-LABEL: bge_test2
-! CHECK-SAME: %[[A:.*]]: !fir.ref<i16>{{.*}}, %[[B:.*]]: !fir.ref<i16>{{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>>{{.*}}
+! CHECK-LABEL: func.func @_QPbge_test2(
+! CHECK-SAME: %[[A:.*]]: !fir.ref<i16> {{.*}}, %[[B:.*]]: !fir.ref<i16> {{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>> {{.*}}) {
subroutine bge_test2(a, b, c)
integer(kind=2) :: a, b
logical :: c
- ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16>
- ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i16>
+ ! CHECK: %[[SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+ ! CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] dummy_scope %[[SCOPE]] arg 1 {uniq_name = "_QFbge_test2Ea"} : (!fir.ref<i16>, !fir.dscope) -> (!fir.ref<i16>, !fir.ref<i16>)
+ ! CHECK: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]] dummy_scope %[[SCOPE]] arg 2 {uniq_name = "_QFbge_test2Eb"} : (!fir.ref<i16>, !fir.dscope) -> (!fir.ref<i16>, !fir.ref<i16>)
+ ! CHECK: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]] dummy_scope %[[SCOPE]] arg 3 {uniq_name = "_QFbge_test2Ec"} : (!fir.ref<!fir.logical<4>>, !fir.dscope) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
+ ! CHECK: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i16>
+ ! CHECK: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i16>
c = bge(a, b)
! CHECK: %[[C_CMP:.*]] = arith.cmpi uge, %[[A_VAL]], %[[B_VAL]] : i16
! CHECK: %[[C_VAL:.*]] = fir.convert %[[C_CMP]] : (i1) -> !fir.logical<4>
- ! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<!fir.logical<4>>
+ ! CHECK: hlfir.assign %[[C_VAL]] to %[[C_DECL]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
end subroutine bge_test2
-! CHECK-LABEL: bge_test3
-! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>>{{.*}}
+! CHECK-LABEL: func.func @_QPbge_test3(
+! CHECK-SAME: %[[A:.*]]: !fir.ref<i32> {{.*}}, %[[B:.*]]: !fir.ref<i32> {{.*}}, %[[C:.*]]: !fir.ref<!fir.logical<4>> {{.*}}) {
subroutine bge_test3(a, b, c)
integer(kind=4) :: a, b
logical :: c
- ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>
- ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+ ! CHECK: %[[SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+ ! CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] dummy_scope %[[SCOPE]] arg 1 {uniq_name = "_QFbge_test3Ea"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! CHECK: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]] dummy_scope %[[SCOPE]] arg 2 {uniq_name = "_QFbge_test3Eb"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+ ! CHECK: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]] dummy_scope %[[SCOPE]] arg 3 {uniq_name = "_QFbge_test3Ec"} : (!fir.ref<!fir.logical<4>>, !fir.dscope) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
+ ! CHECK: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
+ ! CHECK: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/184720
More information about the flang-commits
mailing list