<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/108901>108901</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Implement _split double_ scenario for `asuint` in HLSL
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          joaosaffran
      </td>
    </tr>
</table>

<pre>
    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>

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0V0tz4roS_jVi02XKyGBgwSIxYW6qMnemJrlzZ5cSdoM1I0s-khyS8-tPSbKJIZBiHseVirEeX3d__VCLGcO3EnFBJtdkshywxpZKL74rpgzbbDSTg7UqXha3VS2wQmmBpDEzDZeWpDHkgsktrBsuLJeEZiSNTS24LVSzFkjS2I3FSxJfhf8QAZlcA5ks4Y7LH--AwY7bEkphxCOXVnNpeG6G5RuYq6IAgxWDvMT8h4GN0ntUksYWrILMTf3n7v7uOmCvGplbrmTGhAAu4R4r5tdwuR3mdX1SSK4K3KI8KeCm4raHf_Nca4ebfWgHToL-zyC4TQ5tze1jzoynwSrge7ZtiXD_-fbLVy8fnALvamfRWOMgPJmErtwAoatMFfgBpZNH6Krl2BC6CvRHPa8NHenneT4nwZHYwnurb8_AR6i10qYnJfx_KLmBHXceObC-4sZwuQWNfzVc-_HWyzSZxvF82qraYtGE0ASW327voI_-qfb8kWkW5j7V_2VV-L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