Skip to content

Commit

Permalink
Merge pull request #406 from Xilinx/matthias.emitc_fptoui
Browse files Browse the repository at this point in the history
arith-to-emitc: Fix lowering of fptoui
  • Loading branch information
mgehre-amd authored Dec 2, 2024
2 parents 09f9db8 + da70608 commit 7cba618
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ class FtoICastOpConversion : public OpConversionPattern<CastOp> {
Type actualResultType = dstType;
if (isa<arith::FPToUIOp>(castOp)) {
actualResultType =
rewriter.getIntegerType(operandType.getIntOrFloatBitWidth(),
rewriter.getIntegerType(dstType.getIntOrFloatBitWidth(),
/*isSigned=*/false);
}

Expand Down
4 changes: 4 additions & 0 deletions mlir/test/Conversion/ArithToEmitC/arith-to-emitc.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,10 @@ func.func @arith_float_to_int_cast_ops(%arg0: f32, %arg1: f64) {
// CHECK: emitc.cast %[[CAST0]] : ui32 to i32
%4 = arith.fptoui %arg0 : f32 to i32

// CHECK: %[[CAST0:.*]] = emitc.cast %arg0 : f32 to ui16
// CHECK: emitc.cast %[[CAST0]] : ui16 to i16
%5 = arith.fptoui %arg0 : f32 to i16

return
}

Expand Down

0 comments on commit 7cba618

Please sign in to comment.