[MLIR][Linalg] Add more arith named ops to linalg
authorRenato Golin <rengolin@systemcall.eu>
Wed, 5 Jul 2023 16:13:42 +0000 (17:13 +0100)
committerRenato Golin <rengolin@systemcall.eu>
Wed, 5 Jul 2023 18:29:56 +0000 (19:29 +0100)
commiteda47fdd258ca666815122a931b82699a0629b87
treefbcc8732b7c27454de1e21ef4ba9cf413850487a
parent520681e56d3ab9a9f187a1f9c805ff281b815d55
[MLIR][Linalg] Add more arith named ops to linalg

Following up the 'add' named op, here are the remaining basic arithmetic
and maths, including a 'div_unsigned' for integer unsigned values. In the
same pattern as 'matmul_unsigned', the simply named 'div' assumes signed
values and the '_unsigned' variation handles the unsigned values.

It's a bit odd, but there doesn't seem to be a easy way to restrict to
specific types to make 'div_unsigned' only work with integers in the
structured ops framework.

Same as 'add', these have strict semantics regarding casts.

Unary math ops will need some massaging, so I split these ones for now
as I continue working on them.

Differential Revision: https://reviews.llvm.org/D154524
mlir/include/mlir/Dialect/Linalg/IR/LinalgEnums.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
mlir/test/Dialect/Linalg/generalize-named-ops.mlir
mlir/test/Dialect/Linalg/named-ops-fail.mlir
mlir/test/Dialect/Linalg/named-ops.mlir