[mlir][tosa] Fix clamp to restrict only within valid bitwidth range
authorRobert Suderman <suderman@google.com>
Wed, 18 Aug 2021 18:55:54 +0000 (11:55 -0700)
committerRob Suderman <rob.suderman@gmail.com>
Wed, 18 Aug 2021 19:14:01 +0000 (12:14 -0700)
commit76c9712196906a1c5c1598e196b6abed139f090e
treea0534dc337462ac5a67a262b2925acdb273699b7
parent58e4e71fc8aca712b5662d0654d86ef2ce7fc160
[mlir][tosa] Fix clamp to restrict only within valid bitwidth range

Its possible for the clamp to have invalid min/max values on its range. To fix
this we validate the range of the min/max and clamp to a valid range.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D108256
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir