llvm-capstone/flang/test/Lower/power-operator.f90
Valentin Clement 43c071fa4c
[flang] Lower power operations
Lower the power operation for real, integer
and complex.

The power operation is lowered to library calls.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120403

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D120556
2022-02-28 14:49:14 +01:00

105 lines
2.0 KiB
Fortran

! RUN: bbc -emit-fir %s -o - | FileCheck %s
! Test power operation lowering
! CHECK-LABEL: pow_r4_i4
subroutine pow_r4_i4(x, y, z)
real :: x, z
integer :: y
z = x ** y
! CHECK: call @__fs_powi_1
end subroutine
! CHECK-LABEL: pow_r4_r4
subroutine pow_r4_r4(x, y, z)
real :: x, z, y
z = x ** y
! CHECK: call @__fs_pow_1
end subroutine
! CHECK-LABEL: pow_r4_i8
subroutine pow_r4_i8(x, y, z)
real :: x, z
integer(8) :: y
z = x ** y
! CHECK: call @__fs_powk_1
end subroutine
! CHECK-LABEL: pow_r8_i4
subroutine pow_r8_i4(x, y, z)
real(8) :: x, z
integer :: y
z = x ** y
! CHECK: call @__fd_powi_1
end subroutine
! CHECK-LABEL: pow_r8_i8
subroutine pow_r8_i8(x, y, z)
real(8) :: x, z
integer(8) :: y
z = x ** y
! CHECK: call @__fd_powk_1
end subroutine
! CHECK-LABEL: pow_r8_r8
subroutine pow_r8_r8(x, y, z)
real(8) :: x, z, y
z = x ** y
! CHECK: call @__fd_pow_1
end subroutine
! CHECK-LABEL: pow_r4_r8
subroutine pow_r4_r8(x, y, z)
real(4) :: x
real(8) :: z, y
z = x ** y
! CHECK: %{{.*}} = fir.convert %{{.*}} : (f32) -> f64
! CHECK: call @__fd_pow_1
end subroutine
! CHECK-LABEL: pow_i4_i4
subroutine pow_i4_i4(x, y, z)
integer(4) :: x, y, z
z = x ** y
! CHECK: call @__mth_i_ipowi
end subroutine
! CHECK-LABEL: pow_i8_i8
subroutine pow_i8_i8(x, y, z)
integer(8) :: x, y, z
z = x ** y
! CHECK: call @__mth_i_kpowk
end subroutine
! CHECK-LABEL: pow_c4_i4
subroutine pow_c4_i4(x, y, z)
complex :: x, z
integer :: y
z = x ** y
! CHECK: call @__fc_powi_1
end subroutine
! CHECK-LABEL: pow_c4_i8
subroutine pow_c4_i8(x, y, z)
complex :: x, z
integer(8) :: y
z = x ** y
! CHECK: call @__fc_powk_1
end subroutine
! CHECK-LABEL: pow_c8_i4
subroutine pow_c8_i4(x, y, z)
complex(8) :: x, z
integer :: y
z = x ** y
! CHECK: call @__fz_powi_1
end subroutine
! CHECK-LABEL: pow_c8_i8
subroutine pow_c8_i8(x, y, z)
complex(8) :: x, z
integer(8) :: y
z = x ** y
! CHECK: call @__fz_powk_1
end subroutine