Description
- Implement
f16tof32
clang builtin,Linkf16tof32
clang builtin withhlsl_intrinsics.h
Add sema checks forf16tof32
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen forf16tof32
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/f16tof32.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/f16tof32-errors.hlsl
Create theint_dx_f16tof32
intrinsic inIntrinsicsDirectX.td
Create theDXILOpMapping
ofint_dx_f16tof32
to131
inDXIL.td
Create thef16tof32.ll
andf16tof32_errors.ll
tests inllvm/test/CodeGen/DirectX/
Create theint_spv_f16tof32
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create thef16tof32
lowering and map it toint_spv_f16tof32
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/f16tof32.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
131 | LegacyF16ToF32 | 6.0 | () |
SPIR-V
UnpackHalf2x16:
Description:
UnpackHalf2x16
Result is the two-component floating-point vector with components
obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit
values, interpreting those values as 16-bit floating-point numbers
according to the OpenGL Specification, and converting them to 32-bit
floating-point values. Subnormal numbers are either preserved or flushed
to zero, consistently within an implemenation.
The first component of the vector is obtained from the 16
least-significant bits of v; the second component is obtained from the
16 most-significant bits of v.
The v operand must be a scalar with 32-bit integer type.
Result Type must be a vector of 2 components whose type is 32-bit
floating point.
Number | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
---|---|---|---|---|
62 |
<id> |
Test Case(s)
Example 1
//dxc f16tof32_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(uint4 p1) {
return f16tof32(p1);
}
HLSL:
Converts the float16 stored in the low-half of the uint to a float.
Syntax
float f16tof32(
in uint value
);
Parameters
-
value [in]
-
Type: uint
The input value.
Return value
Type: float
The converted value.
Remarks
The following overloaded versions are also available:
float2 f16tof32(uint2 value);
float3 f16tof32(uint3 value);
float4 f16tof32(uint4 value);
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 4 and higher shader models | yes |
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:
Vertex | Hull | Domain | Geometry | Pixel | Compute |
---|---|---|---|---|---|
x | x | x | x | x | x |
See also
Metadata
Metadata
Assignees
Type
Projects
Status
Activity