[all-commits] [llvm/llvm-project] f57627: [Flang] Initial patch to lower a Fortran intrinsic

kiranchandramohan via All-commits all-commits at lists.llvm.org
Tue Feb 22 04:47:13 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f57627f544665de2b2e246226b0aa3e4a25491e5
      https://github.com/llvm/llvm-project/commit/f57627f544665de2b2e246226b0aa3e4a25491e5
  Author: Kiran Chandramohan <kiran.chandramohan at arm.com>
  Date:   2022-02-22 (Tue, 22 Feb 2022)

  Changed paths:
    A flang/include/flang/Lower/IntrinsicCall.h
    M flang/lib/Lower/CMakeLists.txt
    M flang/lib/Lower/ConvertExpr.cpp
    A flang/lib/Lower/IntrinsicCall.cpp
    A flang/test/Lower/Intrinsics/iand.f90

  Log Message:
  -----------
  [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: Jean Perier <jperier at nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>
Co-authored-by: zacharyselk <zrselk at gmail.com>
Co-authored-by: V Donaldson <vdonaldson at nvidia.com>
Co-authored-by: Valentin Clement <clementval at gmail.com>




More information about the All-commits mailing list