[mlir][arith] Add comparison-based integration tests
authorJakub Kuderski <kubak@google.com>
Tue, 20 Sep 2022 15:37:26 +0000 (11:37 -0400)
committerJakub Kuderski <kubak@google.com>
Tue, 20 Sep 2022 15:38:26 +0000 (11:38 -0400)
commitc521a052f9bf7e418011f98a662be2c434d350ba
tree2441ba850570c3af445c01fecdc794f7a033d56c
parent883048be84779e730b09d0826607d6cac45fad03
[mlir][arith] Add comparison-based integration tests

Introduces a simple framework for runtime tests of the wide integer emulation.

In these tests, we are only interested in checking that both wide and narrow calculation
produce the same results, and do not check for exact results. This allows us to cover
more of the input space, as we do not have to hardcode each of the expected outputs.

Introduce common helper functions to check the results, print a message on mismatch,
and sample the input space.

Implement runtime comparrison tests for `arith.muli` and `arith.shrui`.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D134184
mlir/test/Integration/Dialect/Arithmetic/CPU/test-wide-int-emulation-compare-results-i16.mlir [new file with mode: 0644]