[flang-commits] [flang] [flang][NFC] Converted five tests from old lowering to new lowering (part 35) (PR #187407)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 18 19:48:27 PDT 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: len.f90, lge_lgt_lle_llt.f90, log.f90, matmul.f90, max.f90
---
Patch is 35.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/187407.diff
5 Files Affected:
- (modified) flang/test/Lower/Intrinsics/len.f90 (+49-33)
- (modified) flang/test/Lower/Intrinsics/lge_lgt_lle_llt.f90 (+9-12)
- (modified) flang/test/Lower/Intrinsics/log.f90 (+46-37)
- (modified) flang/test/Lower/Intrinsics/matmul.f90 (+17-54)
- (modified) flang/test/Lower/Intrinsics/max.f90 (+68-65)
``````````diff
diff --git a/flang/test/Lower/Intrinsics/len.f90 b/flang/test/Lower/Intrinsics/len.f90
index 16b865cc89aad..c0ca30a6401dd 100644
--- a/flang/test/Lower/Intrinsics/len.f90
+++ b/flang/test/Lower/Intrinsics/len.f90
@@ -1,68 +1,78 @@
-! RUN: bbc --use-desc-for-alloc=false -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
-! CHECK-LABEL: len_test
+! CHECK-LABEL: func.func @_QPlen_test(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
+! CHECK-SAME: %[[ARG1:.*]]: !fir.boxchar<1> {fir.bindc_name = "c"})
subroutine len_test(i, c)
integer :: i
character(*) :: c
- ! CHECK: %[[c:.*]]:2 = fir.unboxchar %arg1
- ! CHECK: %[[xx:.*]] = fir.convert %[[c]]#1 : (index) -> i32
- ! CHECK: fir.store %[[xx]] to %arg0
+! CHECK: %[[c:.*]]:2 = fir.unboxchar %[[ARG1]]
+! CHECK: hlfir.declare %[[c]]#0 typeparams %[[c]]#1
+! CHECK: %[[IVAL:.*]]:2 = hlfir.declare %[[ARG0]]
+! CHECK: %[[xx:.*]] = fir.convert %[[c]]#1 : (index) -> i32
+! CHECK: hlfir.assign %[[xx]] to %[[IVAL]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: len_test_array
-! CHECK-SAME: %[[arg0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"}, %[[arg1:.*]]: !fir.boxchar<1> {fir.bindc_name = "c"}
+! CHECK-LABEL: func.func @_QPlen_test_array(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
+! CHECK-SAME: %[[ARG1:.*]]: !fir.boxchar<1> {fir.bindc_name = "c"})
subroutine len_test_array(i, c)
integer :: i
character(*) :: c(100)
- ! CHECK: %[[c:.*]]:2 = fir.unboxchar %[[arg1]]
- ! CHECK: %[[xx:.*]] = fir.convert %[[c]]#1 : (index) -> i32
- ! CHECK: fir.store %[[xx]] to %[[arg0]]
+! CHECK: %[[c:.*]]:2 = fir.unboxchar %[[ARG1]]
+! CHECK: hlfir.declare {{.*}} typeparams %[[c]]#1
+! CHECK: %[[IVAL:.*]]:2 = hlfir.declare %[[ARG0]]
+! CHECK: %[[xx:.*]] = fir.convert %[[c]]#1 : (index) -> i32
+! CHECK: hlfir.assign %[[xx]] to %[[IVAL]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_assumed_shape_array(
+! CHECK-LABEL: func.func @_QPlen_test_assumed_shape_array(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.box<!fir.array<?x!fir.char<1,?>>> {fir.bindc_name = "c"}) {
subroutine len_test_assumed_shape_array(i, c)
integer :: i
character(*) :: c(:)
-! CHECK: %[[VAL_2:.*]] = fir.box_elesize %[[VAL_1]] : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> index
+! CHECK-DAG: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK-DAG: %[[C:.*]]:2 = hlfir.declare %[[VAL_1]]
+! CHECK: %[[VAL_2:.*]] = fir.box_elesize %[[C]]#1 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> index
! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_2]] : (index) -> i32
-! CHECK: fir.store %[[VAL_3]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: hlfir.assign %[[VAL_3]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_array_alloc(
+! CHECK-LABEL: func.func @_QPlen_test_array_alloc(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>> {fir.bindc_name = "c"}) {
subroutine len_test_array_alloc(i, c)
integer :: i
character(:), allocatable :: c(:)
-! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_1]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
+! CHECK-DAG: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK-DAG: %[[C:.*]]:2 = hlfir.declare %[[VAL_1]]
+! CHECK: %[[VAL_2:.*]] = fir.load %[[C]]#0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
! CHECK: %[[VAL_3:.*]] = fir.box_elesize %[[VAL_2]] : (!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>) -> index
! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (index) -> i32
-! CHECK: fir.store %[[VAL_4]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: hlfir.assign %[[VAL_4]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_array_local_alloc(
+! CHECK-LABEL: func.func @_QPlen_test_array_local_alloc(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"})
subroutine len_test_array_local_alloc(i)
integer :: i
character(:), allocatable :: c(:)
-! CHECK: %[[VAL_5:.*]] = fir.alloca index {uniq_name = "_QFlen_test_array_local_allocEc.len"}
-! CHECK: %[[VAL_7:.*]] = arith.constant 10 : i32
-! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_7]] : (i32) -> index
-! CHECK: fir.store %[[VAL_10]] to %[[VAL_5]] : !fir.ref<index>
+! CHECK: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK: %[[C10:.*]] = arith.constant 10 : i32
allocate(character(10):: c(100))
-! CHECK: %[[VAL_13:.*]] = fir.load %[[VAL_5]] : !fir.ref<index>
-! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_13]] : (index) -> i32
-! CHECK: fir.store %[[VAL_14]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: %[[C_LOADED:.*]] = fir.load %{{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
+! CHECK: %[[ELESIZE:.*]] = fir.box_elesize %[[C_LOADED]] : (!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>) -> index
+! CHECK: %[[RESULT:.*]] = fir.convert %[[ELESIZE]] : (index) -> i32
+! CHECK: hlfir.assign %[[RESULT]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_alloc_explicit_len(
+! CHECK-LABEL: func.func @_QPlen_test_alloc_explicit_len(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32> {fir.bindc_name = "n"},
! CHECK-SAME: %[[VAL_2:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>> {fir.bindc_name = "c"}) {
@@ -70,40 +80,46 @@ subroutine len_test_alloc_explicit_len(i, n, c)
integer :: i
integer :: n
character(n), allocatable :: c(:)
-! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
+! CHECK-DAG: %[[N:.*]]:2 = hlfir.declare %[[VAL_1]]
+! CHECK-DAG: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK: %[[VAL_3:.*]] = fir.load %[[N]]#0 : !fir.ref<i32>
! CHECK: %[[c0_i32:.*]] = arith.constant 0 : i32
! CHECK: %[[cmp:.*]] = arith.cmpi sgt, %[[VAL_3]], %[[c0_i32]] : i32
! CHECK: %[[len:.*]] = arith.select %[[cmp]], %[[VAL_3]], %[[c0_i32]] : i32
-! CHECK: fir.store %[[len]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: hlfir.assign %[[len]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_pointer_explicit_len(
+! CHECK-LABEL: func.func @_QPlen_test_pointer_explicit_len(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32> {fir.bindc_name = "n"},
subroutine len_test_pointer_explicit_len(i, n, c)
integer :: i
integer :: n
character(n), pointer :: c(:)
-! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
+! CHECK-DAG: %[[N:.*]]:2 = hlfir.declare %[[VAL_1]]
+! CHECK-DAG: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK: %[[VAL_3:.*]] = fir.load %[[N]]#0 : !fir.ref<i32>
! CHECK: %[[c0_i32:.*]] = arith.constant 0 : i32
! CHECK: %[[cmp:.*]] = arith.cmpi sgt, %[[VAL_3]], %[[c0_i32]] : i32
! CHECK: %[[len:.*]] = arith.select %[[cmp]], %[[VAL_3]], %[[c0_i32]] : i32
-! CHECK: fir.store %[[len]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: hlfir.assign %[[len]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
-! CHECK-LABEL: func @_QPlen_test_assumed_shape_explicit_len(
+! CHECK-LABEL: func.func @_QPlen_test_assumed_shape_explicit_len(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "i"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32> {fir.bindc_name = "n"},
subroutine len_test_assumed_shape_explicit_len(i, n, c)
integer :: i
integer :: n
character(n) :: c(:)
-! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
+! CHECK-DAG: %[[N:.*]]:2 = hlfir.declare %[[VAL_1]]
+! CHECK-DAG: %[[I:.*]]:2 = hlfir.declare %[[VAL_0]]
+! CHECK: %[[VAL_3:.*]] = fir.load %[[N]]#0 : !fir.ref<i32>
! CHECK: %[[c0_i32:.*]] = arith.constant 0 : i32
! CHECK: %[[cmp:.*]] = arith.cmpi sgt, %[[VAL_3]], %[[c0_i32]] : i32
! CHECK: %[[len:.*]] = arith.select %[[cmp]], %[[VAL_3]], %[[c0_i32]] : i32
-! CHECK: fir.store %[[len]] to %[[VAL_0]] : !fir.ref<i32>
+! CHECK: hlfir.assign %[[len]] to %[[I]]#0 : i32, !fir.ref<i32>
i = len(c)
end subroutine
diff --git a/flang/test/Lower/Intrinsics/lge_lgt_lle_llt.f90 b/flang/test/Lower/Intrinsics/lge_lgt_lle_llt.f90
index 71e5c6da64c12..4d429ead8851d 100644
--- a/flang/test/Lower/Intrinsics/lge_lgt_lle_llt.f90
+++ b/flang/test/Lower/Intrinsics/lge_lgt_lle_llt.f90
@@ -1,33 +1,30 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
subroutine lge_test
character*3 :: c1(3)
character*7 :: c2(3)
- ! c1(1) = 'a'; c1(2) = 'B'; c1(3) = 'c';
- ! c2(1) = 'A'; c2(2) = 'b'; c2(3) = 'c';
! CHECK: BeginExternalListOutput
- ! CHECK: fir.do_loop
- ! CHECK: CharacterCompareScalar1
+ ! CHECK: hlfir.elemental
+ ! CHECK: hlfir.cmpchar sge
! CHECK: OutputDescriptor
! CHECK: EndIoStatement
print*, lge(c1, c2)
! CHECK: BeginExternalListOutput
- ! CHECK: fir.do_loop
- ! CHECK: CharacterCompareScalar1
+ ! CHECK: hlfir.elemental
+ ! CHECK: hlfir.cmpchar sgt
! CHECK: OutputDescriptor
! CHECK: EndIoStatement
print*, lgt(c1, c2)
! CHECK: BeginExternalListOutput
- ! CHECK: fir.do_loop
- ! CHECK: CharacterCompareScalar1
+ ! CHECK: hlfir.elemental
+ ! CHECK: hlfir.cmpchar sle
! CHECK: OutputDescriptor
! CHECK: EndIoStatement
print*, lle(c1, c2)
! CHECK: BeginExternalListOutput
- ! CHECK: fir.do_loop
- ! CHECK: CharacterCompareScalar1
+ ! CHECK: hlfir.elemental
+ ! CHECK: hlfir.cmpchar slt
! CHECK: OutputDescriptor
! CHECK: EndIoStatement
print*, llt(c1, c2)
end
-
diff --git a/flang/test/Lower/Intrinsics/log.f90 b/flang/test/Lower/Intrinsics/log.f90
index 0e8d173fd8e0a..e82bc7f559b0c 100644
--- a/flang/test/Lower/Intrinsics/log.f90
+++ b/flang/test/Lower/Intrinsics/log.f90
@@ -1,68 +1,77 @@
-! RUN: bbc -emit-fir -hlfir=false -outline-intrinsics %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CHECK,CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CHECK,CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
-! RUN: bbc -emit-fir -hlfir=false --math-runtime=precise -outline-intrinsics %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
-! RUN: bbc -emit-fir -hlfir=false --force-mlir-complex -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST,CMPLX-MLIR"
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CHECK,CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CHECK,CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics -mllvm --force-mlir-complex %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST,CMPLX-MLIR"
-! RUN: %flang_fc1 -fapprox-func -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-APPROX"
+! RUN: %flang_fc1 -emit-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CHECK,CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CHECK,CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
+! RUN: %flang_fc1 -emit-hlfir -mllvm -outline-intrinsics -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes=%if system-aix %{"CMPLX,CMPLX-PRECISE,AIX-LOG"%} %else %{"CMPLX,CMPLX-PRECISE,COMMON-LOG"%}
+! RUN: %flang_fc1 -emit-hlfir -mllvm -outline-intrinsics -mllvm --force-mlir-complex %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST,CMPLX-MLIR"
+! RUN: %flang_fc1 -fapprox-func -emit-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-APPROX"
-! CHECK-LABEL: log_testr
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
+! CHECK-LABEL: func.func @_QPlog_testr(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
subroutine log_testr(a, b)
real :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32>
-! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<f32>
+! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f32.f32(%[[AVAL]]) {{.*}}: (f32) -> f32
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : f32, !fir.ref<f32>
b = log(a)
end subroutine
-! CHECK-LABEL: log_testd
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
+! CHECK-LABEL: func.func @_QPlog_testd(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
subroutine log_testd(a, b)
real(kind=8) :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64>
-! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<f64>
+! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f64.f64(%[[AVAL]]) {{.*}}: (f64) -> f64
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : f64, !fir.ref<f64>
b = log(a)
end subroutine
-! CHECK-LABEL: log_testc
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<complex<f32>> {{.*}}, %[[BREF:.*]]: !fir.ref<complex<f32>> {{.*}})
+! CHECK-LABEL: func.func @_QPlog_testc(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<complex<f32>> {{.*}}, %[[BREF:.*]]: !fir.ref<complex<f32>> {{.*}})
subroutine log_testc(a, b)
complex :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<complex<f32>>
-! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z32.z32(%[[A]]) {{.*}}: (complex<f32>) -> complex<f32>
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<complex<f32>>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<complex<f32>>
+! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z32.z32(%[[AVAL]]) {{.*}}: (complex<f32>) -> complex<f32>
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : complex<f32>, !fir.ref<complex<f32>>
b = log(a)
end subroutine
-! CHECK-LABEL: log_testcd
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<complex<f64>> {{.*}}, %[[BREF:.*]]: !fir.ref<complex<f64>> {{.*}})
+! CHECK-LABEL: func.func @_QPlog_testcd(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<complex<f64>> {{.*}}, %[[BREF:.*]]: !fir.ref<complex<f64>> {{.*}})
subroutine log_testcd(a, b)
complex(kind=8) :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<complex<f64>>
-! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z64.z64(%[[A]]) {{.*}}: (complex<f64>) -> complex<f64>
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<complex<f64>>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<complex<f64>>
+! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z64.z64(%[[AVAL]]) {{.*}}: (complex<f64>) -> complex<f64>
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : complex<f64>, !fir.ref<complex<f64>>
b = log(a)
end subroutine
-! CHECK-LABEL: log10_testr
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
+! CHECK-LABEL: func.func @_QPlog10_testr(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
subroutine log10_testr(a, b)
real :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32>
-! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<f32>
+! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f32.f32(%[[AVAL]]) {{.*}}: (f32) -> f32
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : f32, !fir.ref<f32>
b = log10(a)
end subroutine
-! CHECK-LABEL: log10_testd
-! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
+! CHECK-LABEL: func.func @_QPlog10_testd(
+! CHECK-SAME: %[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
subroutine log10_testd(a, b)
real(kind=8) :: a, b
-! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64>
-! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64
-! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64>
+! CHECK-DAG: %[[A:.*]]:2 = hlfir.declare %[[AREF]]
+! CHECK-DAG: %[[B:.*]]:2 = hlfir.declare %[[BREF]]
+! CHECK: %[[AVAL:.*]] = fir.load %[[A]]#0 : !fir.ref<f64>
+! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f64.f64(%[[AVAL]]) {{.*}}: (f64) -> f64
+! CHECK: hlfir.assign %[[RES]] to %[[B]]#0 : f64, !fir.ref<f64>
b = log10(a)
end subroutine
diff --git a/flang/test/Lower/Intrinsics/matmul.f90 b/flang/test/Lower/Intrinsics/matmul.f90
index 77e7fa213717e..d3e4b7e67c5de 100644
--- a/flang/test/Lower/Intrinsics/matmul.f90
+++ b/flang/test/Lower/Intrinsics/matmul.f90
@@ -1,68 +1,31 @@
-! 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
! Test matmul intrinsic
-! CHECK-LABEL: matmul_test
-! CHECK-SAME: (%[[X:.*]]: !fir.ref<!fir.array<3x1xf32>>{{.*}}, %[[Y:.*]]: !fir.ref<!fir.array<1x3xf32>>{{.*}}, %[[Z:.*]]: !fir.ref<!fir.array<3x3xf32>>{{.*}})
-! CHECK: %[[RESULT_BOX_ADDR:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xf32>>>
-! CHECK: %[[C3:.*]] = arith.constant 3 : index
-! CHECK: %[[C1:.*]] = arith.constant 1 : index
-! CHECK: %[[C1_0:.*]] = arith.constant 1 : index
-! CHECK: %[[C3_1:.*]] = arith.constant 3 : index
-! CHECK: %[[Z_BOX:.*]] = fir.array_load %[[Z]]({{.*}}) : (!fir.ref<!fir.array<3x3xf32>>, !fir.shape<2>) -> !fir.array<3x3xf32>
-! CHECK: %[[X_SHAPE:.*]] = fir.shape %[[C3]], %[[C1]] : (index, index) -> !fir.shape<2>
-! CHECK: %[[X_BOX:.*]] = fir.embox %[[X]](%[[X_SHAPE]]) : (!fir.ref<!fir.array<3x1xf32>>, !fir.shape<2>) -> !fir.box<!fir.array<3x1xf32>>
-! CHECK: %[[Y_SHAPE:.*]] = fir.shape %[[C1_0]], %[[C3_1]] : (index, index) -> !fir.shape<2>
-! CHECK: %[[Y_BOX:.*]] = fir.embox %[[Y]](%[[Y_SHAPE]]) : (!fir.ref<!fir.array<1x3xf32>>, !fir.shape<2>) -> !fir.box<!fir.array<1x3xf32>>
-! CHECK: %[[ZERO_INIT:.*]] = fir.zero_bits !fir.heap<!fir.array<?x?xf32>>
-! CHECK: %[[C0:.*]] = arith.constant 0 : index
-! CHECK: %[[RESULT_SHAPE:.*]] = fir.shape %[[C0]], %[[C0]] : (index, index) -> !fir.shape<2>
-! CHECK: %[[RESULT_BOX_VAL:.*]] = fir.embox %[[ZERO_INIT]](%[[RESULT_SHAPE]]) : (!fir.heap<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.box<!fir.heap<!fir.array<?x?xf32>>>
-! CHECK: fir.store %[[RESULT_BOX_VAL]] to %[[RESULT_BOX_ADDR]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
-! CHECK: %[[RESULT_BOX_ADDR_RUNTIME:.*]] = fir.convert %[[RESULT_BOX_ADDR]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) -> !fir.ref<!fir.box<none>>
-! CHECK: %[[X_BOX_RUNTIME:.*]] = fir.convert %[[X_BOX]] : (!fir.box<!fir.array<3x1xf32>>) -> !fir.box<none>
-! CHECK: %[[Y_BOX_RUNTIME:.*]] = fir.convert %[[Y_BOX]] : (!fir.box<!fir.array<1x3xf32>>) -> !fir.box<none>
-! CHECK: {{.*}}fir.call @_FortranAMatmulReal4Real4(%[[RESULT_BOX_ADDR_RUNTIME]], %[[X_BOX_RUNTIME]], %[[Y_BOX_RUNTIME]], {{.*}}, {{.*}} {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.box<none>, !fir.ref<i8>, i32) -> ()
-! CHECK: %[[RESULT_BOX:.*]] = fir.load %[[RESULT_BOX_ADDR]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
-! CHECK: %[[RESULT_TMP:.*]] = fir.box_addr %[[RESULT_BOX]] : (!fir.box<!fir.heap<!fir.array<?x?xf32>>>) -> !fir.heap<!fir.array<?x?xf32>>
-! CHECK: %[[Z_COPY_FROM_RESULT:.*]] = fir.do_loop
-! CHECK: ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/187407
More information about the flang-commits
mailing list