Skip to content
Commit f57627f5 authored by Kiran Chandramohan's avatar Kiran Chandramohan
Browse files

[Flang] Initial patch to lower a Fortran intrinsic

This patch brings in some initial changes for lowering Fortran
intrinsics. Intrinsics are generally lowered to a mix of FIR and
MLIR operations, runtime calls or LLVM intrinsics. This patch
particularly brings in the lowering of the Fortran `andi` intrinsic
to `arith.andi` in MLIR.

The significant changes are in ConvertExpr.cpp and IntrinsicCall.cpp.
Intrinsic functions occur as part of expressions. Lowering deals with this
in ConvertExpr.cpp in `genval(const Fortran::evaluate::FunctionRef<A> &funcRef)`.
The code in the above mentioned function kicks of a sequence of calls
that ultimately results in a call to the `genIand ` function in
IntrinsicCall.cpp which creates the MLIR `arith.andi` operation.

A few tests are also included.

Note: Generally intrinsics like `iand` can occur in array (elemental)
context, but since that part is not fully supported in lowering, tests
are only added for the scalar context.

This patch is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D119990



Co-authored-by: default avatarJean Perier <jperier@nvidia.com>
Co-authored-by: default avatarEric Schweitz <eschweitz@nvidia.com>
Co-authored-by: default avatarzacharyselk <zrselk@gmail.com>
Co-authored-by: default avatarV Donaldson <vdonaldson@nvidia.com>
Co-authored-by: default avatarValentin Clement <clementval@gmail.com>
parent 380ff31d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment