[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
This commit is contained in:
Valentin Clement 2022-08-18 07:53:26 +02:00
parent 929d201b7a
commit 56d856c195
No known key found for this signature in database
GPG Key ID: 086D54783C928776
2 changed files with 30 additions and 0 deletions

View File

@ -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,

View File

@ -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