diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -169,6 +169,14 @@ if (isa(op) && elementTy.isa()) return rewriter.create(loc, resultTypes, args); + // tosa::BitwiseNotOp + if (isa(op) && elementTy.isa()) { + auto allOnesAttr = rewriter.getIntegerAttr( + elementTy, APInt::getAllOnesValue(elementTy.getIntOrFloatBitWidth())); + auto allOnes = rewriter.create(loc, allOnesAttr); + return rewriter.create(loc, resultTypes, args[0], allOnes); + } + // tosa::BitwiseXOrOp if (isa(op) && elementTy.isa()) return rewriter.create(loc, resultTypes, args); @@ -441,13 +449,14 @@ Value opResult = createLinalgBodyCalculationForElementwiseOp( operation, blockArgs.take_front(operation->getNumOperands()), bodyResultTypes, rewriter); - if (opResult) { + if (!opResult) { didEncounterError = true; + return; } nestedBuilder.create(loc, opResult); }); - if (!didEncounterError) + if (didEncounterError) return failure(); rewriter.replaceOp(operation, linalgOp->getResults()); @@ -1379,6 +1388,7 @@ PointwiseConverter, PointwiseConverter, PointwiseConverter, PointwiseConverter, + PointwiseConverter, PointwiseConverter, PointwiseConverter, PointwiseConverter,