aboutsummaryrefslogtreecommitdiff
path: root/src/TosaDeserialize.cpp
diff options
context:
space:
mode:
authorTatWai Chong <tatwai.chong@arm.com>2024-02-29 00:17:29 -0800
committerTatWai Chong <tatwai.chong@arm.com>2024-03-01 14:01:59 -0800
commitfa591272c05d2a24412b4b5b4398ded17be0912e (patch)
tree53a904684d13e00e079b9a9dac57a917b988048d /src/TosaDeserialize.cpp
parent7720f24131f5672a1137cc7b17edf017e66b6ae7 (diff)
downloadtosa_mlir_translator-fa591272c05d2a24412b4b5b4398ded17be0912e.tar.gz
Change the shift operand of mul to be available to all data types.
Change-Id: I436912af95e4aef1b67b140079070168d158ff49 Signed-off-by: TatWai Chong <tatwai.chong@arm.com>
Diffstat (limited to 'src/TosaDeserialize.cpp')
-rw-r--r--src/TosaDeserialize.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/TosaDeserialize.cpp b/src/TosaDeserialize.cpp
index bd9fc9d..301d0da 100644
--- a/src/TosaDeserialize.cpp
+++ b/src/TosaDeserialize.cpp
@@ -1229,23 +1229,16 @@ std::vector<mlir::Value>
TosaMlirOperatorBuilder::build<Op_MUL>(TosaSerializationOperator *op) const {
mlir::Value input0_val = tensor_map->at(op->GetInputTensorNames()[0]);
mlir::Value input1_val = tensor_map->at(op->GetInputTensorNames()[1]);
+ mlir::Value shift_val = tensor_map->at(op->GetInputTensorNames()[2]);
+
mlir::RankedTensorType output_type =
tensor_type_map->at(op->GetOutputTensorNames()[0]);
assert(op->GetAttributeType() ==
Attribute_MulAttribute); // double check attribute type
- mlir::ValueRange operands;
- if (output_type.getElementType().isInteger(32)) {
- // Integer multiply carries shift argument.
- mlir::Value shift_val = tensor_map->at(op->GetInputTensorNames()[2]);
- operands = {input0_val, input1_val, shift_val};
- } else {
- operands = {input0_val, input1_val};
- }
-
- mlir::Operation *mlir_op =
- op_builder->create<mlir::tosa::MulOp>(loc, output_type, operands);
+ mlir::Operation *mlir_op = op_builder->create<mlir::tosa::MulOp>(
+ loc, output_type, input0_val, input1_val, shift_val);
block->push_back(mlir_op);
return std::vector<mlir::Value>({mlir_op->getResult(0)});
}