[flang-commits] [flang] 56d856c - [flang] Add specific TODO for the REDUCE instrinsic
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Wed Aug 17 22:53:51 PDT 2022
Author: Valentin Clement
Date: 2022-08-18T07:53:47+02:00
New Revision: 56d856c19554443677d25b91693c82dc7f35aa2c
URL: https://github.com/llvm/llvm-project/commit/56d856c19554443677d25b91693c82dc7f35aa2c
DIFF: https://github.com/llvm/llvm-project/commit/56d856c19554443677d25b91693c82dc7f35aa2c.diff
LOG: [flang] Add specific TODO for the REDUCE instrinsic
Add a proper TODO for the REDUCE instrinsic instead of crashing.
Reviewed By: PeteSteinfeld, vdonaldson
Differential Revision: https://reviews.llvm.org/D132020
Added:
flang/test/Lower/Intrinsics/Todo/reduce.f90
Modified:
flang/lib/Lower/IntrinsicCall.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/IntrinsicCall.cpp b/flang/lib/Lower/IntrinsicCall.cpp
index 6b8ab4acccb89..5804bb1df066b 100644
--- a/flang/lib/Lower/IntrinsicCall.cpp
+++ b/flang/lib/Lower/IntrinsicCall.cpp
@@ -542,6 +542,7 @@ struct IntrinsicLibrary {
void genRandomInit(llvm::ArrayRef<fir::ExtendedValue>);
void genRandomNumber(llvm::ArrayRef<fir::ExtendedValue>);
void genRandomSeed(llvm::ArrayRef<fir::ExtendedValue>);
+ fir::ExtendedValue genReduce(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
fir::ExtendedValue genRepeat(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
fir::ExtendedValue genReshape(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
mlir::Value genRRSpacing(mlir::Type resultType,
@@ -907,6 +908,15 @@ static constexpr IntrinsicHandler handlers[]{
{"put", asBox, handleDynamicOptional},
{"get", asBox, handleDynamicOptional}}},
/*isElemental=*/false},
+ {"reduce",
+ &I::genReduce,
+ {{{"array", asBox},
+ {"operation", asAddr},
+ {"dim", asValue},
+ {"mask", asBox, handleDynamicOptional},
+ {"identity", asValue},
+ {"ordered", asValue}}},
+ /*isElemental=*/false},
{"repeat",
&I::genRepeat,
{{{"string", asAddr}, {"ncopies", asValue}}},
@@ -3686,6 +3696,13 @@ void IntrinsicLibrary::genRandomSeed(llvm::ArrayRef<fir::ExtendedValue> args) {
Fortran::lower::genRandomSeed(builder, loc, size, put, get);
}
+// REDUCE
+fir::ExtendedValue
+IntrinsicLibrary::genReduce(mlir::Type resultType,
+ llvm::ArrayRef<fir::ExtendedValue> args) {
+ TODO(loc, "intrinsic: reduce");
+}
+
// REPEAT
fir::ExtendedValue
IntrinsicLibrary::genRepeat(mlir::Type resultType,
diff --git a/flang/test/Lower/Intrinsics/Todo/reduce.f90 b/flang/test/Lower/Intrinsics/Todo/reduce.f90
new file mode 100644
index 0000000000000..7aa6f4a9f3ad3
--- /dev/null
+++ b/flang/test/Lower/Intrinsics/Todo/reduce.f90
@@ -0,0 +1,13 @@
+! RUN: %not_todo_cmd bbc -emit-fir %s -o - 2>&1 | FileCheck %s
+
+interface
+ pure function chfunc(a,b)
+ character(*),intent(in) :: a,b
+ character(3) :: chfunc
+ end function
+ end interface
+ character(3) x(5)
+ print*, reduce(x,chfunc)
+end program
+
+! CHECK: not yet implemented: intrinsic: reduce
More information about the flang-commits
mailing list