@@ -159,9 +159,8 @@ struct FpToFpConversion final : OpRewritePattern<OpTy> {
159159 Location loc = op.getLoc ();
160160 auto inFloatTy = cast<FloatType>(op.getOperand ().getType ());
161161 auto inIntWType = rewriter.getIntegerType (inFloatTy.getWidth ());
162- auto int64Type = rewriter.getI64Type ();
163162 Value operandBits = arith::ExtUIOp::create (
164- rewriter, loc, int64Type ,
163+ rewriter, loc, i64Type ,
165164 arith::BitcastOp::create (rewriter, loc, inIntWType, op.getOperand ()));
166165
167166 // Call APFloat function.
@@ -194,6 +193,10 @@ struct FpToIntConversion final : OpRewritePattern<OpTy> {
194193
195194 LogicalResult matchAndRewrite (OpTy op,
196195 PatternRewriter &rewriter) const override {
196+ if (op.getType ().getIntOrFloatBitWidth () > 64 )
197+ return rewriter.notifyMatchFailure (
198+ op, " result type > 64 bits is not supported" );
199+
197200 // Get APFloat function from runtime library.
198201 auto i1Type = IntegerType::get (symTable->getContext (), 1 );
199202 auto i32Type = IntegerType::get (symTable->getContext (), 32 );
@@ -209,9 +212,8 @@ struct FpToIntConversion final : OpRewritePattern<OpTy> {
209212 Location loc = op.getLoc ();
210213 auto inFloatTy = cast<FloatType>(op.getOperand ().getType ());
211214 auto inIntWType = rewriter.getIntegerType (inFloatTy.getWidth ());
212- auto int64Type = rewriter.getI64Type ();
213215 Value operandBits = arith::ExtUIOp::create (
214- rewriter, loc, int64Type ,
216+ rewriter, loc, i64Type ,
215217 arith::BitcastOp::create (rewriter, loc, inIntWType, op.getOperand ()));
216218
217219 // Call APFloat function.
0 commit comments