[MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.
authorGeorge Mitenkov <georgemitenk0v@gmail.com>
Wed, 10 Jun 2020 23:10:26 +0000 (19:10 -0400)
committerLei Zhang <antiagainst@google.com>
Wed, 10 Jun 2020 23:10:31 +0000 (19:10 -0400)
commitd93d8fcdec68211fd3ac7f586fa67bc065acef6a
treec52187c108538a7333cfbe81a41bf452324de9b6
parent2638aafe1203f64983017f8998fb09ce986a1b28
[MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.

Following the previous revision `D81100`, this commit implements a templated class
that would provide conversion patterns for “straightforward” SPIR-V ops into
LLVM dialect. Templating allows to abstract away from concrete implementation
for each specific op. Those are mainly binary operations. Currently supported
and tested ops are:
- Arithmetic ops: `IAdd`, `ISub`, `IMul`, `FAdd`, `FSub`, `FMul`, `FDiv`,  `FNegate`,
  `SDiv`, `SRem` and  `UDiv`
- Bitwise ops: `BitwiseAnd`, `BitwiseOr`, `BitwiseXor`

The implementation relies on `SPIRVToLLVMConversion` class that makes use of
`OpConversionPattern`.

Differential Revision: https://reviews.llvm.org/D81305
mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
mlir/test/Conversion/SPIRVToLLVM/arithmetic-ops-to-llvm.mlir [new file with mode: 0644]
mlir/test/Conversion/SPIRVToLLVM/bitwise-ops-to-llvm.mlir [new file with mode: 0644]
mlir/test/Conversion/SPIRVToLLVM/convert-to-llvm.mlir [deleted file]