Description
- Implement
firstbitlow
clang builtin, - Link
firstbitlow
clang builtin withhlsl_intrinsics.h
- Add sema checks for
firstbitlow
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
- Add codegen for
firstbitlow
toEmitHLSLBuiltinExpr
inCGBuiltin.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_firstbitlow
intrinsic inIntrinsicsDirectX.td
- Create the
DXILOpMapping
ofint_dx_firstbitlow
to32
inDXIL.td
- Create the
firstbitlow.ll
andfirstbitlow_errors.ll
tests inllvm/test/CodeGen/DirectX/
- Create the
int_spv_firstbitlow
intrinsic inIntrinsicsSPIRV.td
- In SPIRVInstructionSelector.cpp create the
firstbitlow
lowering and map it toint_spv_firstbitlow
inSPIRVInstructionSelector::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
Type
Projects
Status