[ ] Link firstbithigh clang builtin with hlsl_intrinsics.h
[ ] Add sema checks for firstbithigh to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
[ ] Add codegen for firstbithigh to EmitHLSLBuiltinExpr in CGBuiltin.cpp
[ ] Add codegen tests to clang/test/CodeGenHLSL/builtins/firstbithigh.hlsl
[ ] Add sema tests to clang/test/SemaHLSL/BuiltIns/firstbithigh-errors.hlsl
[ ] Create the int_dx_firstbithigh intrinsic in IntrinsicsDirectX.td
[ ] Create the DXILOpMapping of int_dx_firstbithigh to 34 in DXIL.td
[ ] Create the firstbithigh.ll and firstbithigh_errors.ll tests in llvm/test/CodeGen/DirectX/
[ ] Create the int_spv_firstbithigh intrinsic in IntrinsicsSPIRV.td
[ ] In SPIRVInstructionSelector.cpp create the firstbithigh lowering and map it to int_spv_firstbithigh in SPIRVInstructionSelector::selectIntrinsic.
[ ] Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/firstbithigh.ll
DirectX
DXIL Opcode
DXIL OpName
Shader Model
Shader Stages
34
FirstbitSHi
6.0
()
SPIR-V
FindSMsb:
Description:
FindSMsb
Signed-integer most-significant bit, with Value interpreted as a
signed integer.
For positive numbers, the result will be the bit number of the most
significant 1-bit. For negative numbers, the result will be the bit
number of the most significant 0-bit. For a Value of 0 or -1, 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.
This instruction is currently limited to 32-bit width components.
firstbithigh
clang builtin,firstbithigh
clang builtin withhlsl_intrinsics.h
firstbithigh
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
firstbithigh
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/firstbithigh.hlsl
clang/test/SemaHLSL/BuiltIns/firstbithigh-errors.hlsl
int_dx_firstbithigh
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_firstbithigh
to34
inDXIL.td
firstbithigh.ll
andfirstbithigh_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_firstbithigh
intrinsic inIntrinsicsSPIRV.td
firstbithigh
lowering and map it toint_spv_firstbithigh
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/firstbithigh.ll
DirectX
SPIR-V
FindSMsb:
Description:
FindSMsb
Signed-integer most-significant bit, with Value interpreted as a signed integer.
For positive numbers, the result will be the bit number of the most significant 1-bit. For negative numbers, the result will be the bit number of the most significant 0-bit. For a Value of 0 or -1, 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.
This instruction is currently limited to 32-bit width components.
74
<id>
Value
Test Case(s)
Example 1
HLSL:
Gets the location of the first set bit starting from the highest order bit and working downward, per component.
Syntax
Parameters
Return value
Type: [int](/windows/desktop/WinProg/windows-data-types)
The location of the first set bit.
Remarks
For a signed integer, the first significant bit is zero for a negative number.
The following overloaded versions are also available:
Minimum Shader Model
This function is supported in the following shader models.
This function is supported in the following types of shaders:
See also