llvm-project/flang/test/Lower/user-defined-operators.f90
jeanPerier f35f863a88
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957)
Patch 2/3 of the transition step 1 described in

https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7.

All the modified tests are still here since coverage for the direct
lowering to FIR was still needed while it was default. Some already have
an HLFIR version, some have not and will need to be ported in step 2
described in the RFC.

Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do
not need a flag since the HLFIR/no HLFIR output is the same for what is
being tested.
2023-11-13 09:14:05 +01:00

27 lines
927 B
Fortran

! Test use defined operators/assignment
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
! Test user defined assignment
! CHECK-LABEL: func @_QPuser_assignment(
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.type<{{.*}}>>{{.*}}, %[[arg1:.*]]: !fir.ref<i32>{{.*}}) {
subroutine user_assignment(a, i)
type t
real :: x
integer :: i
end type
interface assignment(=)
subroutine my_assign(b, j)
import :: t
type(t), INTENT(OUT) :: b
integer, INTENT(IN) :: j
end subroutine
end interface
type(t) :: a
! CHECK: %[[V_0:[0-9]+]] = fir.alloca i32
! CHECK: %[[V_1:[0-9]+]] = fir.load %arg1 : !fir.ref<i32>
! CHECK: %[[V_2:[0-9]+]] = fir.no_reassoc %[[V_1:[0-9]+]] : i32
! CHECK: fir.store %[[V_2]] to %[[V_0:[0-9]+]] : !fir.ref<i32>
! CHECK: fir.call @_QPmy_assign(%arg0, %[[V_0]]) fastmath<contract> : (!fir.ref<!fir.type<_QFuser_assignmentTt{x:f32,i:i32}>>, !fir.ref<i32>) -> ()
a = i
end subroutine