llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.77k stars 10.97k forks source link

[SPIRV][HLSL] Add clamp intrinsic lowering #88052

Open farzonl opened 2 months ago

farzonl commented 2 months ago

Add an intrinsic like this one from https://github.com/llvm/llvm-project/blob/cfb86ae7497e43e9221ab890221789ae320381e9/llvm/include/llvm/IR/IntrinsicsDirectX.td#L25C1-L26C118 to https://github.com/llvm/llvm-project/blob/1e6ce5e284f5c0e8d64eee21af727bb164eb3caf/llvm/include/llvm/IR/IntrinsicsSPIRV.td#L59

update the clamp.hlsl unit tests: https://github.com/llvm/llvm-project/blob/1e6ce5e284f5c0e8d64eee21af727bb164eb3caf/clang/test/CodeGenHLSL/builtins/clamp.hlsl

and implement the three Clamp Lowering: https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#FClamp https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#UClamp https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#SClamp

damyanp commented 2 months ago

Need resolution to #87367.