[mlir][VectorOps] Lower vector.outerproduct of int vectors

vector.fma and mulf don't work on integers. Use a muli/addi pair or
plain muli instead.

Differential Revision: https://reviews.llvm.org/D83292
This commit is contained in:
Benjamin Kramer
2020-07-07 12:49:32 +02:00
parent b80508703f
commit cca4ac523e
2 changed files with 53 additions and 2 deletions

View File

@@ -1289,9 +1289,16 @@ public:
Value m;
if (acc) {
Value e = rewriter.create<vector::ExtractOp>(loc, rhsType, acc, pos);
m = rewriter.create<vector::FMAOp>(loc, b, op.rhs(), e);
if (eltType.isa<IntegerType>())
m = rewriter.create<AddIOp>(
loc, rewriter.create<MulIOp>(loc, b, op.rhs()), e);
else
m = rewriter.create<vector::FMAOp>(loc, b, op.rhs(), e);
} else {
m = rewriter.create<MulFOp>(loc, b, op.rhs());
if (eltType.isa<IntegerType>())
m = rewriter.create<MulIOp>(loc, b, op.rhs());
else
m = rewriter.create<MulFOp>(loc, b, op.rhs());
}
result = rewriter.create<vector::InsertOp>(loc, resType, m, result, pos);
}