-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the saturate
HLSL Function
#99154
Comments
@llvm/issue-subscribers-clang-frontend Author: Farzon Lotfi (farzonl)
- [ ] Implement `saturate` clang builtin,
- [ ] Link `saturate` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `saturate` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `saturate` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/saturate.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/saturate-errors.hlsl`
- [ ] Create the `int_dx_saturate` intrinsic in `IntrinsicsDirectX.td`
- [ ] Create the `DXILOpMapping` of `int_dx_saturate` to `7` in `DXIL.td`
- [ ] Create the `saturate.ll` and `saturate_errors.ll` tests in `llvm/test/CodeGen/DirectX/`
- [ ] Create the `int_spv_saturate` intrinsic in `IntrinsicsSPIRV.td`
- [ ] In SPIRVInstructionSelector.cpp create the `saturate` lowering and map it to `int_spv_saturate` in `SPIRVInstructionSelector::selectIntrinsic`.
- [ ] Create SPIR-V backend test case in `llvm/test/CodeGen/SPIRV/hlsl-intrinsics/saturate.ll`
DirectX
SPIR-VFClamp:Description:FClamp Result is min(max(x, minVal), maxVal). Result is undefined if The operands must all be a scalar or vector whose component type is Result Type and the type of all operands must be the same type. <table> Test Case(s)Example 1//dxc saturate_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return saturate(p1);
} HLSL:Clamps the specified value within the range of 0 to 1.
Parameters
Return ValueThe x parameter, clamped within the range of 0 to 1. Type Description
Minimum Shader ModelThis function is supported in the following shader models.
See also<dl> <dt> Intrinsic Functions (DirectX HLSL) |
@llvm/issue-subscribers-clang-codegen Author: Farzon Lotfi (farzonl)
- [ ] Implement `saturate` clang builtin,
- [ ] Link `saturate` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `saturate` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `saturate` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/saturate.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/saturate-errors.hlsl`
- [ ] Create the `int_dx_saturate` intrinsic in `IntrinsicsDirectX.td`
- [ ] Create the `DXILOpMapping` of `int_dx_saturate` to `7` in `DXIL.td`
- [ ] Create the `saturate.ll` and `saturate_errors.ll` tests in `llvm/test/CodeGen/DirectX/`
- [ ] Create the `int_spv_saturate` intrinsic in `IntrinsicsSPIRV.td`
- [ ] In SPIRVInstructionSelector.cpp create the `saturate` lowering and map it to `int_spv_saturate` in `SPIRVInstructionSelector::selectIntrinsic`.
- [ ] Create SPIR-V backend test case in `llvm/test/CodeGen/SPIRV/hlsl-intrinsics/saturate.ll`
DirectX
SPIR-VFClamp:Description:FClamp Result is min(max(x, minVal), maxVal). Result is undefined if The operands must all be a scalar or vector whose component type is Result Type and the type of all operands must be the same type. <table> Test Case(s)Example 1//dxc saturate_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return saturate(p1);
} HLSL:Clamps the specified value within the range of 0 to 1.
Parameters
Return ValueThe x parameter, clamped within the range of 0 to 1. Type Description
Minimum Shader ModelThis function is supported in the following shader models.
See also<dl> <dt> Intrinsic Functions (DirectX HLSL) |
saturate
clang builtin,saturate
clang builtin withhlsl_intrinsics.h
saturate
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
saturate
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/saturate.hlsl
clang/test/SemaHLSL/BuiltIns/saturate-errors.hlsl
int_dx_saturate
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_saturate
to7
inDXIL.td
saturate.ll
andsaturate_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_saturate
intrinsic inIntrinsicsSPIRV.td
saturate
lowering and map it toint_spv_saturate
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/saturate.ll
DirectX
SPIR-V
FClamp:
Description:
FClamp
Result is min(max(x, minVal), maxVal). Result is undefined if
minVal > maxVal.The semantics used by min() and max() are those of
FMin and FMax.
The operands must all be a scalar or vector whose component type is
floating-point.
Result Type and the type of all operands must be the same type.
Results are computed per component.
43
<id>
x
<id>
minVal
<id>
maxVal
Test Case(s)
Example 1
HLSL:
Clamps the specified value within the range of 0 to 1.
Parameters
Return Value
The x parameter, clamped within the range of 0 to 1.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
Intrinsic Functions (DirectX HLSL)
The text was updated successfully, but these errors were encountered: