[all-commits] [llvm/llvm-project] 4ba45a: [mlir][StandardToSPIRV] Fix conversion for signed ...

Lei Zhang via All-commits all-commits at lists.llvm.org
Mon Jul 13 13:19:05 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ba45a778a13eab1495a75a14682f874016f3d21
      https://github.com/llvm/llvm-project/commit/4ba45a778a13eab1495a75a14682f874016f3d21
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/SPIRV/SPIRVArithmeticOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td
    M mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
    M mlir/test/Dialect/SPIRV/Serialization/arithmetic-ops.mlir
    M mlir/test/Dialect/SPIRV/arithmetic-ops.mlir

  Log Message:
  -----------
  [mlir][StandardToSPIRV] Fix conversion for signed remainder

Per the Vulkan's SPIR-V environment spec, "for the OpSRem and OpSMod
instructions, if either operand is negative the result is undefined."
So we cannot directly use spv.SRem/spv.SMod if either operand can be
negative. Emulate it via spv.UMod.

Because the emulation uses spv.SNegate, this commit also defines
spv.SNegate.

Differential Revision: https://reviews.llvm.org/D83679




More information about the All-commits mailing list