Description
- Implement
pack_u8
clang builtin,Linkpack_u8
clang builtin withhlsl_intrinsics.h
Add sema checks forpack_u8
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen forpack_u8
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/pack_u8.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/pack_u8-errors.hlsl
Create theint_dx_pack_u8
intrinsic inIntrinsicsDirectX.td
Create theDXILOpMapping
ofint_dx_pack_u8
to220
inDXIL.td
Create thepack_u8.ll
andpack_u8_errors.ll
tests inllvm/test/CodeGen/DirectX/
Create theint_spv_pack_u8
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create thepack_u8
lowering and map it toint_spv_pack_u8
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/pack_u8.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
220 | Pack4x8 | 6.6 | () |
SPIR-V
OpBitcast:
Description:
Bit pattern-preserving type conversion.
Result Type must be an OpTypePointer, or a
scalar or vector of numerical-type.
Operand must have a type of OpTypePointer, or a
scalar or vector of numerical-type. It must be a
different type than Result Type.
Before version 1.5: If either Result Type or Operand is a
pointer, the other must be a pointer or an integer scalar.
Starting with version 1.5: If either Result Type or Operand is a
pointer, the other must be a pointer, an integer scalar, or an integer
vector.
If both Result Type and the type of Operand are pointers, they both
must point into same storage class.
Behavior is undefined if the storage class of Result
Type does not match the one used by the operation that produced the
value of Operand.
If Result Type has the same number of components as Operand, they
must also have the same component width, and results are computed per
component.
If Result Type has a different number of components than Operand,
the total number of bits in Result Type must equal the total number of
bits in Operand. Let L be the type, either Result Type or
Operand’s type, that has the larger number of components. Let S be
the other type, with the smaller number of components. The number of
components in L must be an integer multiple of the number of
components in S. The first component (that is, the only or
lowest-numbered component) of S maps to the first components of L,
and so on, up to the last component of S mapping to the last
components of L. Within this mapping, any single component of S
(mapping to multiple components of L) maps its lower-ordered bits to
the lower-numbered components of L.
Word Count | Opcode | Results | Operands | |
---|---|---|---|---|
4 |
124 |
<id> |
<id> |
Test Case(s)
Example 1
//dxc pack_u8_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export uint8_t4_packed fn(int4 p1) {
return pack_u8(p1);
}
HLSL:
Syntax
p32u8 pack_u8(any_int16or32<4> v);
Type Description
Name | Template Type | Component Type | Size |
---|---|---|---|
ret | scalar | uint8_t4_packed | 1 |
v | vector | int, int16_t, uint, or uint16_t | 4 |
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 6.6 and higher shader models | yes |
Shader Stages
See also
Metadata
Metadata
Assignees
Type
Projects
Status
Activity