[fir] Add fir.select_type conversion placeholder
As for D113662, this patch just add a place holder for the `fir.select_type` operation conversion. This operation is part of F20xx and is not implemented yet. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D113878
This commit is contained in:
parent
112c1c346a
commit
2a299e4f06
|
|
@ -930,6 +930,19 @@ struct LoadOpConversion : public FIROpConversion<fir::LoadOp> {
|
|||
}
|
||||
};
|
||||
|
||||
/// Lower `fir.select_type` to LLVM IR dialect.
|
||||
struct SelectTypeOpConversion : public FIROpConversion<fir::SelectTypeOp> {
|
||||
using FIROpConversion::FIROpConversion;
|
||||
|
||||
mlir::LogicalResult
|
||||
matchAndRewrite(fir::SelectTypeOp select, OpAdaptor adaptor,
|
||||
mlir::ConversionPatternRewriter &rewriter) const override {
|
||||
return rewriter.notifyMatchFailure(
|
||||
select, "fir.select_type codegen is not implemented yet");
|
||||
return failure();
|
||||
}
|
||||
};
|
||||
|
||||
/// conversion of fir::SelectRankOp to an if-then-else ladder
|
||||
struct SelectRankOpConversion : public FIROpConversion<fir::SelectRankOp> {
|
||||
using FIROpConversion::FIROpConversion;
|
||||
|
|
@ -1456,9 +1469,9 @@ public:
|
|||
InsertOnRangeOpConversion, InsertValueOpConversion,
|
||||
IsPresentOpConversion, LoadOpConversion, NegcOpConversion,
|
||||
MulcOpConversion, SelectCaseOpConversion, SelectOpConversion,
|
||||
SelectRankOpConversion, StoreOpConversion, SubcOpConversion,
|
||||
UndefOpConversion, UnreachableOpConversion, ZeroOpConversion>(
|
||||
typeConverter);
|
||||
SelectRankOpConversion, SelectTypeOpConversion, StoreOpConversion,
|
||||
SubcOpConversion, UndefOpConversion, UnreachableOpConversion,
|
||||
ZeroOpConversion>(typeConverter);
|
||||
mlir::populateStdToLLVMConversionPatterns(typeConverter, pattern);
|
||||
mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter,
|
||||
pattern);
|
||||
|
|
|
|||
|
|
@ -50,3 +50,25 @@ func @select_case_charachter(%arg0: !fir.char<2, 10>, %arg1: !fir.char<2, 10>, %
|
|||
^bb3:
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// Test `fir.select_type` conversion failure. Not implemented yet.
|
||||
|
||||
func @bar_select_type(%arg : !fir.box<!fir.type<derived3{f:f32}>>) -> i32 {
|
||||
%0 = arith.constant 1 : i32
|
||||
%2 = arith.constant 3 : i32
|
||||
|
||||
// expected-error@+1{{failed to legalize operation 'fir.select_type'}}
|
||||
fir.select_type %arg : !fir.box<!fir.type<derived3{f:f32}>> [
|
||||
#fir.instance<!fir.int<4>>,^bb1(%0:i32),
|
||||
#fir.instance<!fir.int<8>>,^bb2(%2:i32),
|
||||
unit,^bb5 ]
|
||||
^bb1(%a : i32) :
|
||||
return %a : i32
|
||||
^bb2(%b : i32) :
|
||||
return %b : i32
|
||||
^bb5 :
|
||||
%zero = arith.constant 0 : i32
|
||||
return %zero : i32
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue