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

    <tr>
        <th>Summary</th>
        <td>
            Implement the `QuadAll` 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 `QuadAll` clang builtin,
- [ ] Link `QuadAll` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `QuadAll` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `QuadAll` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/QuadAll.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/QuadAll-errors.hlsl`
- [ ] Create the `int_dx_QuadAll` intrinsic in `IntrinsicsDirectX.td`
- [ ] Create the `DXILOpMapping` of `int_dx_QuadAll` to  `222` in `DXIL.td`
- [ ] Create the `QuadAll.ll` and `QuadAll_errors.ll` tests in `llvm/test/CodeGen/DirectX/`

## DirectX

| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
| ----------- | ----------- | ------------ | ------------- |
| 222 | QuadVote | 6.7 | ('library', 'compute', 'amplification', 'mesh', 'pixel', 'node') |

## SPIR-V

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

## Test Case(s)

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

export bool fn(bool p1) {
    return QuadAll(p1);
}
```
## HLSL:

## Syntax


```syntax
bool QuadAll(bool cond);
```


## 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* | [**scalar**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-scalar.md) | **bool** | 1 |
| *cond* | [**scalar**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-scalar.md) | **bool** | 1 |

## Minimum Shader Model

This function is supported in the following shader models.
|Shader Model | Supported|
|-------------|----------|
|[Shader Model 6.7](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_ShaderModel6_7) and higher shader models | yes |

## Shader Stages

* **Library Shader**
* [**Compute Shader**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3d11/direct3d-11-advanced-stages-compute-shader.md)
* [**Amplification Shader**](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#amplification-shader-and-mesh-shader)
* [**Mesh Shader**](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html)
* [**Pixel Shader**](../direct3dhlsl/dx-graphics-hlsl-writing-shaders-9.md#pixel-shader-basics)
* **Node Shader**


## See also


- [**Intrinsic Functions (DirectX HLSL)**](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src//direct3dhlsl/../direct3dhlsl/dx-graphics-hlsl-intrinsic-functions.md)
- **See [QuadAll](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_7_QuadAny_QuadAll#quadall)**
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWF9v2zgS_zT0CyHBomLZfvCD_9S9AEnbuwRF3wxKHFu8SKSOpBKnn_7AP7LkxE12sV1sdw0HEYfUb2Z-nBkOTbXmBwGwQJMVmmxGtDWlVIs9Vd-lqEa5ZM-LCK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