-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
- Implement
firstbitlowclang builtin, - Link
firstbitlowclang builtin withhlsl_intrinsics.h - Add sema checks for
firstbitlowtoCheckHLSLBuiltinFunctionCallinSemaChecking.cpp - Add codegen for
firstbitlowtoEmitHLSLBuiltinExprinCGBuiltin.cpp - Add codegen tests to
clang/test/CodeGenHLSL/builtins/firstbitlow.hlsl - Add sema tests to
clang/test/SemaHLSL/BuiltIns/firstbitlow-errors.hlsl - Create the
int_dx_firstbitlowintrinsic inIntrinsicsDirectX.td - Create the
DXILOpMappingofint_dx_firstbitlowto32inDXIL.td - Create the
firstbitlow.llandfirstbitlow_errors.lltests inllvm/test/CodeGen/DirectX/ - Create the
int_spv_firstbitlowintrinsic inIntrinsicsSPIRV.td - In SPIRVInstructionSelector.cpp create the
firstbitlowlowering and map it toint_spv_firstbitlowinSPIRVInstructionSelector::selectIntrinsic. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/firstbitlow.ll
DirectX
| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
|---|---|---|---|
| 32 | FirstbitLo | 6.0 | () |
SPIR-V
FindILsb:
Description:
FindILsb
Integer least-significant bit.
Results in the bit number of the least-significant 1-bit in the binary
representation of Value. If Value is 0, the result is -1.
Result Type and the type of Value must both be integer scalar or
integer vector types. Result Type and operand types must have the same
number of components with the same component width. Results are computed
per component.
| Number | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
|---|---|---|---|---|
73 |
<id> |
Test Case(s)
Example 1
//dxc firstbitlow_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export uint4 fn(int4 p1) {
return firstbitlow(p1);
}HLSL:
Returns the location of the first set bit starting from the lowest order bit and working upward, per component.
Syntax
int firstbitlow(
in int value
);Parameters
-
value [in]
-
Type: int
The input value.
Return value
Type: int
The location of the first set bit.
Remarks
The following overloaded versions are also available:
uint2 firstbitlow(uint2 value);
uint3 firstbitlow(uint3 value);
uint4 firstbitlow(uint4 value);Minimum Shader Model
This function is supported in the following shader models.
| Shader Model | Supported |
|---|---|
| Shader Model 5 and higher shader models | yes |
This function is supported in the following types of shaders:
| Vertex | Hull | Domain | Geometry | Pixel | Compute |
|---|---|---|---|---|---|
| x | x | x | x | x | x |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status