| Issue |
108901
|
| Summary |
[HLSL] Implement _split double_ scenario for `asuint` in HLSL
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
joaosaffran
|
Implement `asuint` clang builtin,`splitdouble`,
- [ ] Link `asuint` clang builtin with hlsl_intrinsics.h
- [ ] Add sema checks for `asuin`t to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
- [ ] Add codegen for `asuin`t to EmitHLSLBuiltinExpr in CGBuiltin.cpp
- [ ] Use HLSL `bit_cast` to implement the SPIRV code gen
- [ ] Add codegen tests to clang/test/CodeGenHLSL/builtins/asuint-splitdouble.hlsl
- [ ] Add sema tests to clang/test/SemaHLSL/BuiltIns/asuint-splitdouble-errors.hlsl
This will implement the missing requirements for #70097
## DXIL
Opcode | DXIL OpName | Shader Model | Shader Stages | Description
-- | -- | -- | -- | --
102 | SplitDouble | 6.0 | () | splits a double into low and high parts
## SPIR-V
There is no support for asuint when targeting SPIR-V.
# asuint
Interprets the bit pattern of *x* as an unsigned integer.
| ret asuint(*x*) |
|-----------------|
## Test Case(s)
### Example 1
```hlsl
//dxc asuint_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export uint4 fn(double4 p1, uint4 p2, uint4 p3) {
asuint(p1, p2, p3);
return p3;
}
```
## Parameters
| Item | Description |
|--------------------------------------------------------|------------------------------------|
| <span id="x"></span><span id="X"></span>*x*<br/> | \[in\] The input value.<br/> |
## Return Value
The input interpreted as an unsigned integer.
## Type Description
| Name | [**Template Type**](dx-graphics-hlsl-intrinsic-functions.md) | [**Component Type**](dx-graphics-hlsl-intrinsic-functions.md) | Size |
|-------|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|--------------------------------|
| *x* | [**scalar**](dx-graphics-hlsl-intrinsic-functions.md), **vector**, or **matrix** | [**float**](/windows/desktop/WinProg/windows-data-types), [**int**](/windows/desktop/WinProg/windows-data-types) | any |
| *ret* | same as input *x* | [**uint**](/windows/desktop/WinProg/windows-data-types) | same dimension(s) as input *x* |
## Minimum Shader Model
This function is supported in the following shader models.
| Shader Model | Supported |
|---------------------------------------------------------------------|-----------|
| [Shader Model 4](dx-graphics-hlsl-sm4.md) and higher shader models | yes |
| [Shader Model 3 (DirectX HLSL)](dx-graphics-hlsl-sm3.md) | no |
| [Shader Model 2 (DirectX HLSL)](dx-graphics-hlsl-sm2.md) | no |
| [Shader Model 1 (DirectX HLSL)](dx-graphics-hlsl-sm1.md) | no |
## See also
<dl> <dt>
[**Intrinsic Functions (DirectX HLSL)**](dx-graphics-hlsl-intrinsic-functions.md)
</dt> </dl>
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs