HomePhabricator

[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.

Authored by ergawy on Dec 23 2020, 6:32 AM.

Description

[MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp.

Adds rewrite patterns to convert select+cmp instructions into clamp
instructions whenever possible. Support is added to convert:

  • FOrdLessThan, FOrdLessThanEqual to GLSLFClampOp.
  • SLessThan, SLessThanEqual to GLSLSClampOp.
  • ULessThan, ULessThanEqual to GLSLUClampOp.

Reviewed By: mravishankar

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