[ ] Link f32tof16 clang builtin with hlsl_intrinsics.h
[ ] Add sema checks for f32tof16 to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
[ ] Add codegen for f32tof16 to EmitHLSLBuiltinExpr in CGBuiltin.cpp
[ ] Add codegen tests to clang/test/CodeGenHLSL/builtins/f32tof16.hlsl
[ ] Add sema tests to clang/test/SemaHLSL/BuiltIns/f32tof16-errors.hlsl
[ ] Create the int_dx_f32tof16 intrinsic in IntrinsicsDirectX.td
[ ] Create the DXILOpMapping of int_dx_f32tof16 to 130 in DXIL.td
[ ] Create the f32tof16.ll and f32tof16_errors.ll tests in llvm/test/CodeGen/DirectX/
[ ] Create the int_spv_f32tof16 intrinsic in IntrinsicsSPIRV.td
[ ] In SPIRVInstructionSelector.cpp create the f32tof16 lowering and map it to int_spv_f32tof16 in SPIRVInstructionSelector::selectIntrinsic.
[ ] Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/f32tof16.ll
DirectX
DXIL Opcode
DXIL OpName
Shader Model
Shader Stages
130
LegacyF32ToF16
6.0
()
SPIR-V
PackHalf2x16:
Description:
PackHalf2x16
Result is the unsigned integer obtained by converting the components of
a two-component floating-point vector to the 16-bit OpTypeFloat, and
then packing these two 16-bit integers into a 32-bit unsigned integer.
The first vector component specifies the 16 least-significant bits of
the result; the second component specifies the 16 most-significant
bits.
The v operand must be a vector of 2 components whose type is a 32-bit
floating-point.
Although this function is available in Shader Model 4 and higher shader models, because it is emulated in 4.0 and 4.1, it is less perfomant on these shader models than it is on Shader Model 5.
This function is supported in the following types of shaders:
f32tof16
clang builtin,f32tof16
clang builtin withhlsl_intrinsics.h
f32tof16
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
f32tof16
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/f32tof16.hlsl
clang/test/SemaHLSL/BuiltIns/f32tof16-errors.hlsl
int_dx_f32tof16
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_dx_f32tof16
to130
inDXIL.td
f32tof16.ll
andf32tof16_errors.ll
tests inllvm/test/CodeGen/DirectX/
int_spv_f32tof16
intrinsic inIntrinsicsSPIRV.td
f32tof16
lowering and map it toint_spv_f32tof16
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/f32tof16.ll
DirectX
SPIR-V
PackHalf2x16:
Description:
PackHalf2x16
Result is the unsigned integer obtained by converting the components of a two-component floating-point vector to the 16-bit OpTypeFloat, and then packing these two 16-bit integers into a 32-bit unsigned integer. The first vector component specifies the 16 least-significant bits of the result; the second component specifies the 16 most-significant bits.
The v operand must be a vector of 2 components whose type is a 32-bit floating-point.
Result Type must be a 32-bit integer type.
58
<id>
v
Test Case(s)
Example 1
HLSL:
Converts an input into a float16 type.
Syntax
Parameters
Return value
Type: uint
The converted value, stored in the low-half of the uint.
Remarks
The following overloaded versions are also available:
Minimum Shader Model
This function is supported in the following shader models.
Although this function is available in Shader Model 4 and higher shader models, because it is emulated in 4.0 and 4.1, it is less perfomant on these shader models than it is on Shader Model 5.
This function is supported in the following types of shaders:
See also