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

    <tr>
        <th>Summary</th>
        <td>
            Implement the `AddUint64` HLSL Function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            metabug,
            backend:DirectX,
            HLSL,
            bot:HLSL
      </td>
    </tr>

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

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

<pre>
    - [ ] Implement `AddUint64` clang builtin,
- [ ] Link `AddUint64` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `AddUint64` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `AddUint64` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/AddUint64.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/AddUint64-errors.hlsl`
- [ ] Create the `int_dx_AddUint64` intrinsic in `IntrinsicsDirectX.td`
- [ ] Create the `DXILOpMapping` of `int_dx_AddUint64` to  `44` in `DXIL.td`
- [ ] Create the `AddUint64.ll` and `AddUint64_errors.ll` tests in `llvm/test/CodeGen/DirectX/`

## DirectX

| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
| ----------- | ----------- | ------------ | ------------- |
| 44 | UAddc | 6.0 | () |

## SPIR-V

There is no support for `AddUint64` when targeting SPIR-V.

## Test Case(s)

 
 ### Example 1
```hlsl
//dxc AddUint64_test.hlsl -T lib_6_8 -enable-16bit-types -O0

export uint4 fn(uint4 p1, uint4 p2) {
    return AddUint64(p1, p2);
}
```
## HLSL:

## Syntax


```syntax
uint<2> AddUint64(uint<2> a, uint<2> b);
```

```syntax
uint<4> AddUint64(uint<4> a, uint<4> b);
```


## Type Description

| Name  | [**Template Type**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-data-types.md)| [**Component Type**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-data-types.md) | Size |
|-------|--------------------------------------------------------------------|----------------------------------------------------------------------|------|
| *ret* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 2 |
| *a* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 2 |
| *b* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 2 |
## Type Description

| Name  | [**Template Type**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-data-types.md)| [**Component Type**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-data-types.md) | Size |
|-------|--------------------------------------------------------------------|----------------------------------------------------------------------|------|
| *ret* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 4 |
| *a* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 4 |
| *b* | [**vector**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-vector.md) | [**uint**](../WinProg/windows-data-types) | 4 |

## Minimum Shader Model

This function is supported in the following shader models.
|Shader Model | Supported|
|-------------|----------|
|[Shader Model 6](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/shader-model-6-0.md) and higher shader models | yes |

## Shader Stages



## See also


- [**Intrinsic Functions (DirectX HLSL)**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-intrinsic-functions.md)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWE1v4zgP_jXKRbDhyI6bHHLIRzNvgfadwbazO7dCthhbW1kyJKVN59cvJDmx04_MYRfYGWyDFLUp6iH1kGJAUmN4JQHmaLJEk_WI7myt9HxL9XclxahQ7HkeYTRZYjRZ46umFdCAtBjlyYKxr1zaPEN5gktBZYWLHReWS0RWKFn02665fDi_Az9xWzuVWhhxz6XVXBpemrhGeXKCtWAMG2goLmsoHwzeKv0K2ionWjmF_13fXi-Djc1OlpYruaJCOC0undYtNNRrclnFZdu-Za9UDCqQZ2xdNtwOTF3uW92bWH3qxD_Ct2Cs6RA9PYhsnAyRzUox-ATS2UBk07FmENkcnYkdde-ydQbaMdDhej-vTnEj0Fpp8yb8SgO1gG0NDpdLe8_29yf0HEPZcXF1DO2aayjtt9iy86jrb1fXn9sb2rZcVg5Sbd8zZhV2S1nWc-92_9BEz2HIDCrZifi-oyCsBioDvBCPzasgIbLpDofIJlh2X5IikuLDSpBdrLDzEH9uXQ7gwfv_aRPeb2vKQOMbxUAMBbeWVmCcpAOK-g_-wftrQTQAyjK__HXBWOmf8jjx_xGZIjI7aB6PdPvl6rfo9yC6q0ED5gZLhc2ubZW2b16bp9rlO9UVWC6rDiI-gb0DY_GKGkBkahCZhUXs_7yGU7rcU1eT8Nit5kn4-lR1OBtENmxf4j6SLlI-lXF0hwUv7vP7KY5A0kJANM4LbiP73ILB0ecubrD3h9hxaTO8lYhMw2M7RmTViVsSeFk65zDGGuxOy94sItOg7hVRuvRMr4c-9-f2dzFdnFL8LC3dd6LBLnOQOz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