[flang][Evaluate] Fold DBLE
We can reuse the folding of REAL. Differential Revision: https://reviews.llvm.org/D122214
This commit is contained in:
parent
e4a42c5b64
commit
d2663fcc39
|
@ -127,7 +127,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
|
|||
} else if (name == "product") {
|
||||
auto one{Scalar<T>::FromInteger(value::Integer<8>{1}).value};
|
||||
return FoldProduct<T>(context, std::move(funcRef), one);
|
||||
} else if (name == "real") {
|
||||
} else if (name == "real" || name == "dble") {
|
||||
if (auto *expr{args[0].value().UnwrapExpr()}) {
|
||||
return ToReal<KIND>(context, std::move(*expr));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
! RUN: %python %S/test_folding.py %s %flang_fc1
|
||||
! Tests folding of DBLE()
|
||||
module ft_data
|
||||
integer nx, ny, nz
|
||||
parameter (nx=64, ny=64, nz=64, maxdim=64)
|
||||
double precision ntotal_f
|
||||
parameter (ntotal_f = dble(nx)*ny*nz)
|
||||
logical, parameter :: test_dble_1 = ntotal_f == real(nx*ny*nz, kind(0.0D0))
|
||||
logical, parameter :: test_dble_2 = kind(dble(nx)) == kind(0.0D0)
|
||||
end module ft_data
|
Loading…
Reference in New Issue