Loading mlir/parsers/qasm3/examples/adder.qasm +3 −5 Original line number Diff line number Diff line Loading @@ -62,11 +62,9 @@ qubit a[8]; qubit b[8]; qubit cout; bit ans[9]; // FIXME: left shift casting to handle different type: // e.g. i8 vs. i64 (shift value) uint[64] a_in = 1; uint[64] b_in = 15; // Input values: uint[8] a_in = 1; uint[8] b_in = 15; for i in [0:8] { // FIXME: not able to do this inline.... Loading mlir/transforms/lowering/InstOpLowering.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,14 @@ LogicalResult IntegerCastOpLowering::matchAndRewrite( mlir::IntegerType type = to_be_cast.getType().cast<mlir::IntegerType>(); auto cast_op = rewriter.create<LLVM::DialectCastOp>( loc, rewriter.getIntegerType(type.getWidth(), false), to_be_cast); if (resultCastOp.getType().getWidth() < type.getWidth()) { auto trunc_op = rewriter.create<LLVM::TruncOp>(loc, resultCastOp.getType(), cast_op.res()); rewriter.replaceOp(op, trunc_op.res()); } else { rewriter.replaceOp(op, cast_op.res()); } return success(); } } // namespace qcor No newline at end of file Loading
mlir/parsers/qasm3/examples/adder.qasm +3 −5 Original line number Diff line number Diff line Loading @@ -62,11 +62,9 @@ qubit a[8]; qubit b[8]; qubit cout; bit ans[9]; // FIXME: left shift casting to handle different type: // e.g. i8 vs. i64 (shift value) uint[64] a_in = 1; uint[64] b_in = 15; // Input values: uint[8] a_in = 1; uint[8] b_in = 15; for i in [0:8] { // FIXME: not able to do this inline.... Loading
mlir/transforms/lowering/InstOpLowering.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,14 @@ LogicalResult IntegerCastOpLowering::matchAndRewrite( mlir::IntegerType type = to_be_cast.getType().cast<mlir::IntegerType>(); auto cast_op = rewriter.create<LLVM::DialectCastOp>( loc, rewriter.getIntegerType(type.getWidth(), false), to_be_cast); if (resultCastOp.getType().getWidth() < type.getWidth()) { auto trunc_op = rewriter.create<LLVM::TruncOp>(loc, resultCastOp.getType(), cast_op.res()); rewriter.replaceOp(op, trunc_op.res()); } else { rewriter.replaceOp(op, cast_op.res()); } return success(); } } // namespace qcor No newline at end of file