[all-commits] [llvm/llvm-project] 8386a3: [HLSL] implement `clamp` intrinsic (#85424)
Farzon Lotfi via All-commits
all-commits at lists.llvm.org
Fri Mar 15 17:57:30 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8386a388bd4f144889401cc503b2c51bf4bb9275
https://github.com/llvm/llvm-project/commit/8386a388bd4f144889401cc503b2c51bf4bb9275
Author: Farzon Lotfi <1802579+farzonl at users.noreply.github.com>
Date: 2024-03-15 (Fri, 15 Mar 2024)
Changed paths:
M clang/include/clang/Basic/Builtins.td
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/Headers/hlsl/hlsl_intrinsics.h
M clang/lib/Sema/SemaChecking.cpp
A clang/test/CodeGenHLSL/builtins/clamp-builtin.hlsl
A clang/test/CodeGenHLSL/builtins/clamp.hlsl
A clang/test/SemaHLSL/BuiltIns/clamp-errors.hlsl
M clang/test/SemaHLSL/BuiltIns/mad-errors.hlsl
M llvm/include/llvm/IR/IntrinsicsDirectX.td
M llvm/lib/Target/DirectX/DXIL.td
M llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
A llvm/test/CodeGen/DirectX/clamp-vec.ll
A llvm/test/CodeGen/DirectX/clamp.ll
A llvm/test/CodeGen/DirectX/fmax.ll
A llvm/test/CodeGen/DirectX/fmin.ll
A llvm/test/CodeGen/DirectX/smax.ll
A llvm/test/CodeGen/DirectX/smin.ll
M llvm/test/CodeGen/DirectX/umax.ll
A llvm/test/CodeGen/DirectX/umin.ll
Log Message:
-----------
[HLSL] implement `clamp` intrinsic (#85424)
closes #70071
- `CGBuiltin.cpp` - Add the unsigned\generic clamp intrinsic emitter.
- `IntrinsicsDirectX.td` - add the `dx.clamp` & `dx.uclamp` intrinsics
- `DXILIntrinsicExpansion.cpp` - add the `clamp` instruction expansion
while maintaining vector form.
- `SemaChecking.cpp` - Add `clamp` builtin Sema Checks.
- `Builtins.td` - add a `clamp` builtin
- `hlsl_intrinsics.h` - add the `clamp` api
Why `clamp` as instruction expansion for DXIL?
1. SPIR-V has a GLSL `clamp` extension via:
-
[FClamp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#FClamp)
-
[UClamp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#UClamp)
-
[SClamp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#SClamp)
2. Further Clamp lowers to `min(max( x, min_range ), max_range)` which
we have float, signed, & unsigned dixilOps.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list